Rebranding
unknown
plain_text
4 years ago
450 B
3
Indexable
#include <stdio.h>
char N[200005];
int main(void){
int n,m;
char x,y;
scanf("%d %d",&n,&m);
scanf("%s",N);
for(int i=0;i<m;i++){
scanf(" %c %c",&x,&y);
if(x==y) continue;
for(int j=0;j<n;j++){
if(N[j]==x){
N[j]=y;
}
else if(N[j]==y){
N[j]=x;
}
}
}
printf("%s\n",N);
return 0;
}Editor is loading...