TOPIC

Wrong Answer 10%

Kaio Ferreira asked 2 years ago

include <bits/stdc++.h>

using namespace std;

int main() { int A,B; char C,D;

scanf("%d %d",&A,&B);

map <char,char> Map;
map <char,char>::iterator it;

while(A--)  {

    cin>>C>>D;
    Map[D] = C;
    Map[C] = D;
}

getchar();

while(B--){
    string S;
    getline(cin,S);

    for (int i = 0; i < (int) S.size() ; i++){
        it = Map.find(S[i]);
        if(it != Map.end()){
            S[i] = Map[S[i]];
        }
    }

    cout<<S<<endl;
}

}

Remember not post solutions. Your post may be reviewed by our moderators.