output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <cstdio> #include <iostream> using namespace std; int main(){ while(1){ int n, m; char a[1000][3]; scanf(" %d", &n); if(n==0) break; for(int i=0; i<n; ++i){ scanf(" %c %c", &a[i][0], &a[i][1]); } scanf(" %d", &m); for(int i=0; i<m; ++i){ char c; scanf(" %c", &c); for(...
### Prompt Please provide a CPP coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #include<map> #include<vector> using namespace std; int main() { int n; while(cin>>n){ if(n==0) break; vector<char> ans; map<char,char> M; for(int i=0;i<n;i++){ char in,out; cin>>in>>out; M[in]=out; } int k; cin>>k; for(int i=0;i<k;i++){ char s; cin>>s; if(!M.c...
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include<stdio.h> int main(){ int n,m,i,j; char nn[1000000],nm[1000000],mm[1000000]; while(1){ scanf("%d",&n); if(!n)break; for(i=0;i<n;i++){ scanf(" %c %c",&nn[i],&nm[i]); } scanf("%d",&m); for(i=0;i<m;i++){ scanf(" %c",&mm[i]); for(j=0;j<n;j++)if(mm[i]==nn[j]){ mm[i]=nm[j]; break; ...
### Prompt Generate a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <iostream> #include <vector> #include <map> using namespace std; int main(void){ while (1) { int n; cin >> n; if (!n) break; map<char, char> trans; for (int i = 0; i < n; i++) { char c, c2; cin >> c >> c2; trans[c] = c2; } int m; cin >> m; for (int i = 0; i < m; i++) { char b; cin >...
### Prompt Your task is to create a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> using namespace std; int main(){ int n; while(cin >> n && n){ int m = 0, henkan[10000] = {}; char in, iin; for(int i = 0; i < n; i++){ cin >> in >> iin; int ctoi = in, ctoii = iin; henkan[ctoi] = ctoii; } cin >> m; for(int i = 0; i < m; i++){ cin >> in; int ctoi = in; ...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> using namespace std; char v[256];int n,m; int main(){ while(true){ cin>>n;for(int i=32;i<127;i++){v[i]=i;} if(n==0)break; for(int i=0;i<n;i++){char p,q;cin>>p>>q;v[p]=q;} cin>>m; for(int i=0;i<m;i++){ char f;cin>>f;cout<<v[f]; } cout<<endl; } return 0; }
### Prompt Your task is to create a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> using namespace std; int main(){ int n,m,i,j; char **a,*b; while(cin>>n){ if(n==0){break;} a=new char*[n]; for(i=0;i<n;i++){ a[i]=new char[2]; } for(i=0;i<n;i++){ cin>>a[i][0]>>a[i][1]; } cin>>m; b=new char[m+1]; for(i=0;i<m;i++){ cin>>b[i]; for(j=0;j<n;j++){ if(...
### Prompt Construct a Cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#import<iostream> #define z std::cin>> int main(){int n;for(char a,b;z n,n;puts("")){int d[256]={};for(;n--;d[a]=b-a)z a>>b;for(z n;n--;putchar(a+d[a]))z a;}}
### Prompt Please formulate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; char d[100000000],h[1000],h2[1000]; int main(){ int hN,dN; while(1){ cin>>hN; if(hN==0) break; for(int i=0;i<hN;i++){ cin>>h[i]>>h2[i]; } cin>>dN; for(int i=0;i<dN;i++){ cin>>d[i]; } for(int i=0;i<dN;i++){ for(int j=0;j<hN;j++){ if(d[i]==h[j]){ d[i]=h2[j];...
### Prompt Generate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> using namespace std; int main(){ int n; while(cin>>n){ if(n==0) break; char c[n][2],s; for(int i=0;i<n;i++) cin >> c[i][0] >> c[i][1]; int m; cin >> m; for(int i=0;i<m;i++){ cin >> s; bool ok = true; for(int j=0;j<n;j++){ if(s==c[j][0]){ cout << c[j][...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> using namespace std; int main(){ int n, m; char aft[130]; bool exi[130]; char a, b; while(true){ cin >> n; if(n == 0) break; for(int i = 0; i < 130; i++) exi[i] = false; for(int i = 0; i < n; i++){ cin >> a >> b; aft[(int)a] = b; exi[(int)a] = true; } cin >> ...
### Prompt Generate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <iostream> using namespace std; int main() { int n, m; while (cin >> n){ if (n == 0){ break; } char bucket[256]; for (int i = 0; i < 256; i++){ bucket[i] = i; } for (int i = 0; i < n; i++){ char c, d; cin >> c >> d; bucket[c] = d; } cin >> m; ...
### Prompt Please formulate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; char conv[128]; int main() { int n; while(cin >> n && n) { for(int i = 0; i < 128; ++i) conv[i] = i; for(int i = 0; i < n; ++i) { char a, b; cin >> a >> b; conv[a] = b; } int m; cin >> m; while(m--) { char c; cin >> c; ...
### Prompt Please create a solution in cpp to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<stdio.h> #include<iostream> using namespace std; int main(){ long long int N; while(1){ char G[1001]; for(int i=0;i<1000;i++) { G[i]=-1; } cin>>N;if(N==0)break; for(int i=0;i<N;i++){ char x,y; cin>>x>>y; G[x]=y; } int NN; cin>>NN; for(int i=0;i<NN;i++){ char h; cin>>h; if(G[h]==-1...
### Prompt In cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <iostream> #include <string> #include <map> using namespace std; int main() { int n, m; cin >> n; while (n > 0) { map<string, string> tr; for (int i = 0; i < n; i++) { string a, b; cin >> a >> b; tr[a] = b; } cin >> m; string s; for (int i = 0; i < m; i++) { string t; ci...
### Prompt Generate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <iostream> #include <vector> using namespace std; struct tr{ char f; char t; }; int main(){ vector<tr> trs; tr t; int n,m,l,f; while(cin>>n,n){ while(n--){ cin >> t.f >> t.t; trs.push_back(t); } cin>>m; while(m--){ f=0; cin >> t.f; for(l=0;l<trs.size();l++){ if(t.f==trs[l].f)...
### Prompt Generate a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> using namespace std; struct str { char h; char w; }; str v[100000]; char t,b[100000]; int main() { long long int j,i,n,m; while(1) { cin>>n; if(n==0) break; for(i=0;i<n;i++) { cin>>v[i].h>>v[i].w; } cin>>m; for(i=0;i<m;i++) { cin>>t; for(j=0;j<n;j++) { if(t==v[...
### Prompt Your challenge is to write a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> #include <map> using namespace std; int main(){ int n; char x,y; for(;cin>>n,n;cout<<endl){ map<char,char>m; for(;n;n--){ cin>>x>>y; m[x]=y; } for(cin>>n;n;n--){ cin>>x; cout<<(m[x]?m[x]:x); } } }
### Prompt Please formulate a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> using namespace std; int main() { int i, j, n, m; char be, af, tmp; while (1) { cin >> n; if (n == 0)break; char cvrt[128] = {}; for (i = 0; i < n; i++) { cin >> be >> af; cvrt[be] = af; } cin >> m; for (i = 0; i < m; i++) { cin >> tmp; if (cvrt[tmp] == 0) { cout <<...
### Prompt Develop a solution in cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> #include<string> using namespace std; int main(){ while(1){ int m,n; char cha[100000],con[100000],a[100000]; cin>>m; if(m==0)break; for(int i=0;i<m;i++){ cin>>cha[i]>>con[i]; } cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; for(int j=0;j<m;j++){ if(a[i]==cha[j]){ a[i]=con...
### Prompt Develop a solution in CPP to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<bits/stdc++.h> using namespace std; int main(void){ int n; int m; char data; bool flg=false; while(1){ cin>>n; char a[n+1],b[n+1]; if(n==0){ break; } for(int i=0;i<n;i++){ cin>>a[i]>>b[i]; } cin>>m; for(int i=0;i<m;i++){ cin>>data; flg=false; for(int j=0;j<n;j++){ if(d...
### Prompt Create a solution in Cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include<bits/stdc++.h> using namespace std; using Int = long long; //INSERT ABOVE HERE signed main(){ int n; while(cin>>n,n){ map<char,char> m; for(int i=0;i<n;i++){ char c,d; cin>>c>>d; m[c]=d; } string ans; int q; cin>>q; while(q--){ char x; cin>>x; ...
### Prompt Your challenge is to write a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<string> #include<cstdio> #include<map> int main(){ using namespace std; int a,b; char c,d,s[9]; map<char,char> code; while(scanf("%d",&a),a){ while(a--){ scanf(" %c %c",&c,&d); code[c]=d; } scanf("%d",&a); while(a--){ scanf(" %c",&c); if(code.count(c)==1){ putchar(code[c]); }...
### Prompt Your task is to create a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> #include <map> using namespace std; int main(void){ int n; while(cin >> n && n){ char x,y; map<char,char> m; for(int i=0;i<n;i++){ cin >> x >> y; m[x] = y; } cin >> n; for(int i=0;i<n;i++){ cin >> x; if(m.find(x) == m.end()){ cout << x; }else{ cout << m[x]; ...
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include<stdio.h> int main(void) { int n,m; int i,j; char a[100],b[100],c; scanf("%d",&n); while(n!=0){ for(i=0;i<n;i++){ scanf(" %c %c",&a[i],&b[i]); } scanf("%d",&m); for(i=0;i<m;i++){ scanf(" %c",&c); for(j=0;j<n;j++){ if(a[j]==c){ c=b[j]; break; } } printf("%c",c); }...
### Prompt Construct a cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#include <iostream> #define N 51 #define M 100001 using namespace std; int main() { while(true){ int n,m; char mae[N],ato[N]; cin >> n; if(n<=0) break; for(int i=0;i<n;i++){ cin >> mae[i] >> ato[i]; } cin >> m; for(int i=0;i<m;i++){ char ch; cin >> ch; ...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include<iostream> #include<map> #include<stdio.h> using namespace std; int main(){ int in; while(1){ cin >> in; if(in == 0) break; map<char, char> M; char a, b; for(int i = 0; i < in; i++){ cin >> a >> b; M[a] = b; } cin >> in; for(int i = 0; i < in; i++)...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> #include <string> using namespace std; int main(){ int n, m, z[200], xx, yy; string x, y, out; while (cin >> n) { if (n == 0) { break; } for (int i = 0; i < 200; i++) { z[i] = i; } out = ""; for (int i = 0; i < n; i++) { cin >> x >> y; xx = x[0]; yy = y[0]; z[xx] = yy; ...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <iostream> #include <map> using namespace std; int main() { int n; while( cin >> n, n ) { map<char, char> mp; for( int i=0; i<n; i++ ) { char a, b; cin >> a >> b; mp[a] = b; } string res = ""; int m; cin >> m; for( int i=0; i<m; i++ ) { char a; ...
### Prompt Please create a solution in CPP to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <stdio.h> #define num_element 150 int main(void) { int i,n,m; char array[num_element]; char a[2]; char b[2]; char input[2]; while(1) { for(i=0;i<num_element;i++) { array[i] = i; } scanf("%d",&n); if(n == 0)return 0; for(i=0;i<n;i++) { scanf("%s %s",a,b); array[a[0]] = b[0]; } ...
### Prompt Develop a solution in Cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; int main() { int n, m; char cstr[100][2], str[1000000]; cin >> n; while (n != 0){ for (int i = 0; i < n; i++) cin >> cstr[i][0] >> cstr[i][1]; cin >> m; for (int i = 0; i < m; i++){ cin >> str[i]; for (int j = 0; j < n; j++){ if (str[i] == cstr[j][0]){ ...
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> #include <map> using namespace std; map<char, char> conv; int main() { int n, m; while((cin >> n) && n) { conv.clear(); for(int i = 0; i < n; ++i) { char a, b; cin >> a >> b; conv[a] = b; } cin >> m; for(int i = 0; i < m; ++i) { char c; cin >> c...
### Prompt Your task is to create a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; char k[100][2]; int m; char a; while (cin >> n) { if (n == 0) { break; } for (int i = 0; i < n; i++) { cin >> k[i][0] >> k[i][1]; } cin >> m; for (int i = 0; i < m; i++) { cin >> a; for (int i = 0; i < n; i+...
### Prompt Develop a solution in Cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> #include<map> using namespace std; int main(void) { map<char, char> chgMap; int num; char in1, in2; int i; while(true) { cin >> num; if(num == 0) { break; } chgMap.clear(); for(i = 0; i < num; i++) { cin >> in1 >> in2; chgMap[in1] = in2; } cin >> num; for(i = 0; i < num; i...
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> #include <cstdio> using namespace std; int main(){ long i,j,n,m; char rend[65536][2],cash; while(1){ cin >> n; if(!n) break; for(i=0;i<n;i++){scanf(" %c %c",&rend[i][0],&rend[i][1]);} cin >> m; for(j=0;j<m;j++){ cin >> cash; for(i=0;i<n;i++){ if(cash==rend[i][0]){cash=rend[i]...
### Prompt Please create a solution in cpp to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> #include <map> int main(int argc, char** argv){ int n; while(std::cin >> n, n){ std::map<char, char> trans; for(; n > 0; --n){ char before, after; std::cin >> before >> after; trans[before] = after; } std::cin >> n; for(; n > 0; --n){ char c; st...
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> #include <map> using namespace std; int main( void ) { while (1) { map <char, char> T; int n; cin >> n; if ( n == 0) break; for ( int i = 0; i < n; ++i ) { char c; cin >> c; cin >> T[c]; } string answer; int m; cin >> m; for ( int i = 0; i < m; ++i ) { ...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> using namespace std; int main() { int n, m; char table[256]; while (cin >> n, n) { for (int i = 0; i < 256; i++) table[i] = 0; for (int i = 0; i < n; i++) { char a, b; cin >> a >> b; table[a] = b; } cin >> m; for (int i = 0; i < m; i++) { char a; cin >> a; if...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <cstdio> #include <cstring> char tb[128]; int main() { int n,m; while(scanf("%d",&n),n) { memset(tb,0,sizeof(tb)); for(int i=0;i<n;i++) { getchar(); char ch1=getchar(),ch2=(getchar(),getchar()); tb[ch1]=ch2; } scanf("%d",&m); for(int i=0;i<m;i++) { getchar(); char ch=getchar(); if...
### Prompt Develop a solution in cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> int main(void){ char hen[128]; int n; while(true){ for(int i=0; i<128; i++) hen[i] = i; std::cin >> n; if(!n) break; for(int i=0; i<n; i++){ char from, to; std::cin >> from >> to; hen[from] = to; } std::cin >> n; for(int i=0; i<n; i++){ char c; std::cin >> c; s...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #include<map> #include<stdio.h> using namespace std; int main(){ int in; while(1){ cin >> in; if(in == 0) break; map<char, char> M; char a, b; for(int i = 0; i < in; i++){ cin >> a >> b; M[a] = b; } cin >> in; for(int i = 0; i < in; i++)...
### Prompt Construct a cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#include <iostream> using namespace std; int main(){ int n,i,tail; char s; char dic[256]; while(cin>>n,n){ for(i=0;i<256;i++) dic[i]=i; while(n--){ cin>>s; cin>>dic[(int)s]; } cin>>n; while(n--){ cin>>s; cout<<dic[(int)s]; } cout<<endl; } }
### Prompt Please provide a CPP coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <bits/stdc++.h> using namespace std; int main(){ int N,M; char graph[128]; while(scanf("%d",&N),N){ for(int i = 0;i < 128;i++)graph[i] = i; char a,b; for(int i = 0;i < N;i++){ scanf(" %c %c",&a,&b); graph[a] = b; } cin >> M; for(int i = 0;i < M;i++){ scanf(" %c",...
### Prompt Generate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <stdio.h> int main(){ int n,i,j,m,f; char a[100],b[100],x; while(1){ scanf("%d ",&n); if(n==0)break; for(i=0;i<n;i++){ scanf("%c %c ",&a[i],&b[i]); } scanf("%d ",&m); for(i=0;i<m;i++){ scanf("%c ",&x); f=0; for(j=0;j<n;j++){ if(x==a[j]){ printf("%c",b[j]); f=1; break; } } if(f==0){ printf("%c",x); } } prin...
### Prompt Develop a solution in CPP to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> #include<map> using namespace std; int main(){ int n, m; char a, b; map<char, char> ma; while(cin >> n, n){ ma.clear(); for(int i=0; i < n; i++){ cin >> a >> b; ma[a] = b; } cin >> m; for(int i=0; i < m; i++){ cin >> a; if(ma[a] != '\0') cout << ma[a]; else cout << a; ...
### Prompt Construct a Cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#include<iostream> #include<algorithm> #include<vector> #include<map> #include<string> using namespace std; int main(){ int n; while(cin>>n,n){ string str=""; string bef="",aft=""; for(int i=0;i<n;i++){ char b,a; cin>>b>>a; bef+=b; aft+=a; } int n2; cin>>n2; for(int i=0;i<n2;i++){ cha...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; int main(){ int n,m; string s; while(cin>>n,n){ char a[n][3],d; r(i,n){cin>>a[i][0]>>a[i][1];} cin>>m; char s[m]; r(i,m)cin>>s[i]; r(i,m){r(j,n)if(s[i]==a[j][0]){s[i]=a[j][1];break;}} r(i,m)cout<<s[i]; ...
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> #include <map> using namespace std; int main(){ char a,b; int n, m; while(true){ map<char,char> mp; cin >> n; if( !n ) break; while( n-- ){ cin >> a >> b; mp[a] = b; } cin >> m; while( m-- ){ cin >> a; if( mp.find(a) == mp.end() ) co...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <stdio.h> int main(){ int n,m; int i,j; scanf("%d",&n); while(n!=0){ char before[n],after[n]; for(i=0;i<n;i++){ scanf(" %c %c",&before[i],&after[i]); } scanf("%d",&m); char data[m]; for(i=0;i<m;i++){ scanf(" %c",&data[i]); for(j=0;j<n;j++){ if(data[i]==before[j]){ data[i]=afte...
### Prompt Develop a solution in cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; int main(){ int n; while(1){ cin >> n; if(n==0) break; int data[130]; for(int i=0;i<130;i++){ data[i]=i; } for(int i=0;i<n;i++){ char a, b; cin >> a >> b; data[(int)a]=(int)b; } int m; cin >> m; for(int i=0;...
### Prompt Generate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> #include<map> #include<string> using namespace std; int main(){ int n; while(cin>>n && n){ map<string,string> change; for(int i=0;i<n;i++){ string s1,s2; cin>>s1>>s2; change[s1]=s2; } int m; cin>>m; string ans; for(int i=0;i<m;i++){ string s; cin>>s; if(change...
### Prompt Create a solution in Cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); while(n){ map<char,char> trans; char c1,c2; for(int i=0;i<n;i++){ scanf(" %c %c",&c1,&c2); trans[c1]=c2; } scanf("%d",&n); for(int i=0;i<n;i++){ scanf(" %c",&c1); if(trans.find(c1)!=trans.end()){ printf("%c...
### Prompt Your task is to create a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#import<iostream> using namespace std; int main(){ int n, m; char a, b; while(cin>>n, n){ int d[256] = {}; for(int i=0;i<n;i++){ cin >> a >> b; d[a] = b-a; } for(cin>>n;n--;printf("%c", a+d[a])) cin>>a; puts(""); } }
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include<iostream> using namespace std; int main() { for(int n;cin>>n,n;){ char map[128]; for(int i=0;i<128;i++) map[i]=0; for(int i=0;i<n;i++){ char a,b; cin>>a>>b; map[a]=b; } int l; cin>>l; for(int i=0;i<l;i++){ char c; cin>>c; cout<<(map[c]?map[c]:c); } cout<<endl; } return 0; }
### Prompt Create a solution in cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> using namespace std; char dic[64][2]={""}; int main(){ int n,i,tail; char s; while(1){ tail=0; cin>>n; if(!n) return 0; while(n--){ cin>>dic[tail][0]; cin>>dic[tail++][1]; } cin>>n; while(n--){ for(cin>>s,i=0;i<tail;i++) if(s == dic[i][0]){ cout<<dic[i][1]; break;} ...
### Prompt In CPP, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <cstdio> #include <cstring> char C[127]; int main() { int n,m; while(scanf("%d",&n),n) { getchar(); char ch1,ch2; memset(C,0,sizeof(C)); for(int i=0;i<n;i++) { ch1=getchar();getchar(); ch2=getchar();getchar(); C[ch1]=ch2; } scanf("%d",&m); getchar(); for(int i=0;i<m;i++) { char ch...
### Prompt Generate a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> #include<map> using namespace std; int main() { while (1){ int n; cin >> n; if(n == 0) break; map <char,char> a2b; char a,b; for(int i = 0;i < n; i++){ cin >> a >> b; a2b[a]=b; } int m; cin >> m; for(int i = 0;i < m; i++){ cin >> a; ...
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include<bits/stdc++.h> using namespace std; map<char,char> ma; int main(){ ios_base::sync_with_stdio(false); int n,m; char a,b; while(1){ cin >> n; if(n==0) break; for(int i=0;i<n;i++){ cin >> a >> b; ma[a]=b; } cin >> m; char temp; for(int i=0;i<m;i++){ cin >> t...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include<bits/stdc++.h> using namespace std; map<char,char> mem; int main(){ char c; int n,m; while(cin>>n,n){ mem.clear(); for(int i=0;i<n;i++){ char a,b; cin>>a>>b; mem[a]=b; } cin>>m; for(int i=0;i<m;i++){ cin>>c; if(mem.find(c)!=mem.end()){ cout<<mem[c]; ...
### Prompt Generate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
//24 #include<iostream> using namespace std; int main(){ for(int n;cin>>n,n;){ char t[128]={}; while(n--){ char a,b; cin>>a>>b; t[a]=b; } int m; cin>>m; while(m--){ char c; cin>>c; cout<<((t[c])?t[c]:c); } cout<<endl; } return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #include<cstdio> #include<map> using namespace std ; int main(){ int n; char a,b; for(;;){ map<char,char> a2b; cin>>n; if(n==0)break; for(int i=0;i<n;i++){ cin >> a >> b; a2b[a]=b; } cin>>n; for(int i=0;i<n;i++){ cin>>a; if(a2b.count(a)==0){ cou...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> #include <cstdio> using namespace std; #define rep(i,n) for(int i=0;i<n;++i) #define rep1(i,n) for(int i=1;i<=n;++i) #define ALL(c) (c).begin(),(c).end() char s[10000],t[10000]; int main(){ while(true){ int n; cin >> n; if(!n) break; rep(i,n) cin >> s[i] >> t[i]; int m; cin >> m; rep(...
### Prompt Your challenge is to write a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #include<string> #include<map> using namespace std; int main() { int n, o; while (cin >> n, n) { map<char, char>m; for (int i = 0;i < n;i++) { char a, b; cin >> a >> b; m[a]=b; } cin >> o; string sa; for (int i = 0;i < o;i++) { char a; cin >> a; auto itr = m.find(a...
### Prompt Your challenge is to write a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> using namespace std; int main(){ while(1){ int a, mozi; cin >> a ; if(a==0)break; char wrong[a], right[a]; for(int i=0; i < a; i++){ cin >> wrong[i] >> right[i]; } cin >> mozi; char mozire[mozi]; for(int j=0; j < mozi; j++){ cin >> mozire[j]; for(int f=0; f < a; f++){ if(mozire[j...
### Prompt Develop a solution in Cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; int main() { for (;;) { int n; cin >> n; if (!n) return 0; char T[128]; for (int i = 0; i < 128; i++) T[i] = char(i); for (int i = 0; i < n; i++) { char f, t; cin >> f >> t; T[f] = t; } int m; cin >> m; for (int...
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> using namespace std; int main(){ int n,m; char c[128],f; string s; while(cin >> n && n){ s = ""; for(int i=0;i<128;i++)c[i]=i; for(int i=0;i<n;i++){ cin >> f; cin >> c[f]; } cin >> m; for(int i=0;i<m;i++){ ...
### Prompt Construct a Cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#include<iostream> #define max 255 using namespace std; int main(){ char c,ch,d,change[max]; int n,m; while(cin >>n && n!=0){ for(int i=0;i<max;i++)change[i]=i; for(int i=0;i<n;i++){ cin >>c>>ch; change[c]=ch; } cin >>m; for(int i=0;i<m;i++){ cin >>d; ...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
/* JOI 2006  予選 問2 言語 : C++ 必須知識: */ #include <iostream> using namespace std; int main(void) { int N,M; while( cin >> N, N > 0){ char change[1000]={}; // 大雑把に配列確保 char a,b; for(int i = 0; i < N; i++){ cin >> a >> b; change[a] = b; } cin >> M; char c; for(int i = 0; i < M; i++){ cin >...
### Prompt Your challenge is to write a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <stdio.h> int main(){ int n,i,j,m,f; char a[256],b[256],x; while(1){ scanf("%d ",&n); if(n==0){ break; } for(i=0;i<n;i++){ scanf("%s %s ",&a[i],&b[i]); } scanf("%d ",&m); for(i=0;i<m;i++){ scanf("%s",&x); f=0; for(j=0;j<n;j++){ if(x==a[j]){ printf("%c",b[j]); f=1; brea...
### Prompt Please create a solution in Cpp to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> using namespace std; int main(){ int n = 0; while(cin >> n && n){ int m = 0, henkan[10000] = {}; char in, iin; for(int i = 0; i < n; i++){ cin >> in >> iin; int ctoi = in, ctoii = iin; henkan[ctoi] = ctoii; } cin >> m; for(int i = 0; i < m; i++){ cin >> in; int ctoi = i...
### Prompt Please formulate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> #include<string> using namespace std; int main(){ int n; int m; char data[5000][2]; string s; while(true){ cin>>n; if(n==0)break; string str; for(int i=0;i<n;i++){ cin>>data[i][0]>>data[i][1]; } cin>>m; for(int i=0;i<m;i++){ cin>>s; str=str+s; } for(int i=0;i<str.siz...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <iostream> using namespace std; int main(){ int n, m; char c[256]; char a,b; while( cin >> n && n ){ for( int i=0;i<256;i++ ) c[i] = '.'; while( n-- ){ cin >> a >> b; c[(int)a] = b; } cin >> m; while( m-- ){ cin >> a; if( c[(int)a]!='.' ){ cout << c...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include<iostream> using namespace std; int main() { while (true){ int n; cin >> n; if (!n) break; char order[128]; for (int i = 0; i < 128; i++) order[i] = i; for (int i = 0; i < n; i++){ char in1, in2; cin >> in1 >> in2; order[in1] = in2; } int m; cin >> m; for (int i = 0; i < m; i++){ ...
### Prompt Create a solution in Cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> #include <map> #include <string> using namespace std; int main ( void ) { int n; while ( cin >> n, n ) { map<char, char> t; for (int i = 0; i < n; ++i) { char a, b; cin >> a >> b; t[a] = b; } int m; cin >> m; string out = ""; for (int i = 0; i < m; ++i) { char...
### Prompt Generate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <stdio.h> int main(){ int n,i,j,m,f; char a[100],b[100],x; while(1){ scanf("%d ",&n); if(n==0){ break; } for(i=0;i<n;i++){ scanf("%c %c ",&a[i],&b[i]); } scanf("%d ",&m); for(i=0;i<m;i++){ scanf("%c ",&x); f=0; for(j=0;j<n;j++){ if(x==a[j]){ printf("%c",b[j]); f=1; bre...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include<iostream> using namespace std ; int main() { int n ; while( cin >> n ,n ) { char C[ n + 1 ] ,c[ n + 1 ] ; for( int i = 0 ; i < n ; i++ ) { cin >> C[ i ] >> c[ i ] ; } int m ; char str ; cin >> m ; for( int i = 0 ; i < m ; i++ ) { cin >> str ; for( int j = 0 ; j < n ; j++ ) { ...
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> using namespace std; int main(){ int n; char henkan[1000]; char ch,t_ch; while( cin >> n,n){ for(int i = 0 ; i < 1000 ; i++ )henkan[i] = '\0'; while(n--){ cin >> ch >> t_ch; henkan[ ch ] = t_ch; } cin >> n; while(n--){ cin >> ch; if(henkan[ ch ] != '\0'){ c...
### Prompt Please create a solution in cpp to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> using namespace std; int main(){ char a,b,c[128],d[128]; int n,i; while(cin>>n){ if(n==0)break; for(i=0;i<128;i++)c[i]=d[i]=i; for(i=0;i<n;i++){cin>>a>>b;c[a]=d[b];} cin>>n; for(i=0;i<n;i++){cin>>a;cout<<c[a];} cout<<endl; } return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> using namespace std; int main() { int m,n; char from[100],to[100],x; while(cin >> n) { if(n == 0) break; for(int i=0;i<n;i++) { cin >> from[i] >> to[i]; } cin >> m; for(int i=0;i<m;i++) { cin >> x; for(int j=0;j<n;j++) { if(x == from[j]) { x = to[j]; ...
### Prompt Create a solution in CPP for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <cstdio> using namespace std; char conv[256]; int n,m; int main(){ char c; char s1[2]; char s2[2]; while(scanf("%d",&n) && n){ for(int i=0;i<256;i++){ conv[i] = i; } for(int i=0;i<n;i++){ scanf("%s %s",s1,s2); conv[*s1] = *s2; } scanf("%d",&m); for(int i=0;i<m;i++){ scanf("%s",s1...
### Prompt Generate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> #include<map> using namespace std; int main(){ char a,b,c; int n; for( ; ; ){ cin>> n; if(n==0)break; map<char,char> a2b; for(int i=0;i<n;i++){ cin>>a>>b; a2b[a]=b; } cin>>n; for(int i=0;i<n;i++){ cin>>c; if(a2b.count(c)==0) cout<<c; ...
### Prompt Create a solution in CPP for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <stdio.h> int main(void){ int n=0,m=0; while(scanf("%d",&n),n){ char change[100][2]; char s; for(int i=0;i<n;i++) scanf(" %c %c", &change[i][0], &change[i][1]); scanf("%d",&m); for(int j=0;j<m;j++){ scanf(" %c", &s); for(int k=0;k<n;k++){ if(s==change[k][0]){ s=change[k][1]; ...
### Prompt Please create a solution in CPP to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include<iostream> #include<string> using namespace std; int main() { for(;;){ int n,m; string s1[1000],s2[1000]; string ans=""; string s; cin >> n; if(n==0)return 0; for(int i=0;i<n;i++){ cin >> s1[i] >> s2[i]; } cin >> m; for(int i=0;i<m;i++){ cin >> s; bool f=true; for(int j=0;j<n;j++){ if(s==s1[j]){ ans+=s2[j]; f=f...
### Prompt Create a solution in Cpp for the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table...
#include <iostream> #include <map> #include <iterator> int main(){ int n; std::map< char, char > m; while( std::cin >> n, n ){ while( n-- ){ char c[2]; std::cin >> c[0] >> c[1]; m[c[0]] = c[1]; } std::cin >> n; while( n-- ){ char c; std::map< char, char >::iterator it; std::cin >> ...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; char m[99][2],z,y;int main(){int s,n;while(1){cin>>s;if(s==0)break;rep(i,s)cin>>m[i][0]>>m[i][1];cin>>n;rep(i,n){cin>>z;y=z;rep(j,s)if(m[j][0]==z)y=m[j][1];cout<<y;}cout<<endl;}return 0;}
### Prompt In cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define REP(i,N) for(int i = 0; i < (int)N; i++) int main(){ int n; while(cin >> n){ if(n==0)break; map<char,char> mp; REP(i,n){ char from,to; cin >> from >> to; mp[from] = to; } int n; cin >> n; REP(i,n){ char c; cin >>...
### Prompt Your challenge is to write a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; string str; char c[256], t; while (cin >> n, n){ str = ""; for (int i = 0; i < 256; i++) c[i] = i; for (int i = 0; i < n; i++){ cin >> t; cin >> c[t]; } cin >> m; for (int i = 0; i < m; i++){ cin >> t...
### Prompt Please formulate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> #include <string> using namespace std; int main() { while(1){ int a; cin >> a; if(a == 0){break;} char *b = new char [a]; char *c = new char [a]; for(int i = 0;i < a;i++){ cin >> b[i] >> c[i]; } int m; cin >> m; for(int i = 1;i <= m;i++){ char p; cin >> p; int ii = 0; while(ii < a){ if(p == b[ii])...
### Prompt Please provide a Cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> using namespace std; int main(){ int i,j,n,x,l; char a[100001],b[100001],c[100001],m; while(true){ cin>>n; if(n==0){ break; } for(i=0;i<n;i++){ cin>>a[i]>>b[i]; } cin>>x; for(j=0;j<x;j++){ cin>>c[j]; } for(l=0;l<x;l++){ for(int k=0;k<n;++k){ if(c[l]==a[k]){ c[l]=b[k]; br...
### Prompt Please provide a cpp coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include <iostream> #define REP(i, a, n) for(int i = a; i < n; i++) using namespace std; int n, m; char table[256]; char c, d; int main(void) { while(1) { cin >> n; if(n == 0) break; REP(i, 0, 256) table[i] = (char) i; REP(i, 0, n) { cin >> c >> d; table[c] = d; } cin >> m; ...
### Prompt Generate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include <stdio.h> int main(){ int n,i,j,m,f; char a[256],b[256],x; while(1){ scanf("%d ",&n); if(n==0){ break; } for(i=0;i<n;i++){ scanf("%c %c ",&a[i],&b[i]); } scanf("%d ",&m); for(i=0;i<m;i++){ scanf("%c ",&x); f=0; for(j=0;j<n;j++){ if(x==a[j]){ printf("%c",b[j]); f=1; bre...
### Prompt Construct a cpp code solution to the problem outlined: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion ta...
#include <iostream> using namespace std; int main() { int n; char ch[256]; while(1) { for (int i=0; i<256; i++) ch[i]=i; cin >> n; if (n==0) break; for (int i=0; i<n; i++) { char a, b; cin >> a >> b; ch[a]=b; } int m; cin >> m; for (...
### Prompt Please provide a CPP coded solution to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the ...
#include<iostream> #include<map> using namespace std; int main(){ for(;;){ int n, m; map<char, char> mpa; cin >> n; if(n == 0) break; for(int i = 1; i <= n; i++){ char a, b; cin >> a >> b; mpa[a] = b; } cin >> m; for(int i = 1; i <= m; i++){ char c; cin >>...
### Prompt In Cpp, your task is to solve the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion tabl...
#include <iostream> using namespace std; int main() { int n, m; char *conv_from, *conv_to; while(cin >> n, n){ conv_from = new char [n]; conv_to = new char [n]; for(int i=0; i<n; i++){ cin >> conv_from[i] >> conv_to[i]; } cin >> m; for(; m; m--){ char c; cin >> c; for(int i=0; i<n; i++){ ...
### Prompt Please formulate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <stdio.h> #include <map> using namespace std; int main(){ while(1){ map<char, char> data; int n,i; scanf("%d", &n); if(n==0) break; char a,b; for(i=0;i<n;i++) { scanf(" %c %c", &a, &b); data.insert(pair<char,char>(a,b)); } scanf("%d", &n); for(i=0;i<n;i++){ scanf(" %c", &a);...
### Prompt Please formulate a Cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#include <iostream> #include <map> #include <algorithm> #define rep(i, n) for(int i = 0; i < (n); ++i) using namespace std; int n; map<char, char> c; int main(){ while(1){ cin >> n; if(!n){ break; } rep(i, n){ char a, b; cin >> a >> b; c[a] = b; } int q; cin >> q; rep(i, q){ char p; ...
### Prompt Your task is to create a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> using namespace std; int n,m; char cha[2][100]; char str[100000000]; void solve() { for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ if(str[i] == cha[0][j]){ str[i] = cha[1][j]; break; } } cout << str[i]; } cout << endl; } int main() { cin >> n; while(n){ for(int i=0;i<n;i++...
### Prompt Generate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion table. ...
#include<iostream> #include<map> using namespace std; int N,M; void solve(){ map<char,char>mp; for(int i = 0 ; i < N ; i++){ char a,b; cin >> a >> b; mp[a] = b; } cin >> M; for(int i = 0 ; i < M ; i++){ char c; cin >> c; if(mp.find(c) != mp.end())cout << mp[c]; else cout << c; ...
### Prompt Develop a solution in cpp to the problem described below: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...
#import<iostream> #define z std::cin>> int main(){for(int n;z n,n;puts("")){char a,b,d[256]={};for(;n--;d[a]=b-a)z a>>b;for(z n;n--;putchar(a+d[a]))z a;}}
### Prompt Your task is to create a CPP solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conv...
#include <iostream> #include <vector> using namespace std; int main(){ while(1){ int n; cin >> n; if(n==0) break; vector<char> conv(128); for(int i=0; i<128; i++) conv[i]=i; for(int i=0; i<n; i++){ char a,b; cin >> a >> b; conv[a] = b; } int m; cin >> m; string ret=""; for(int i=0...
### Prompt Please formulate a cpp solution to the following problem: Create a program that converts data based on the given conversion table. The characters used in the data are letters or numbers, and the letters are case sensitive. There is no regularity in the order of the characters that appear in the conversion...