TOPIC

O que está errado?

André asked 2 years ago

include include

int main () { int n,m,i,j,k,t; char letra[10001], troca[10001], palavra[100001]; scanf("%d %d",&n,&m); for(i=0;i<n;i++){ scanf("%c%c",&letra[i]); scanf("%c%c",&troca[i]); } for(i=0;i<m;i++){ scanf("%*c%[^\n]",palavra); t=strlen(palavra); for(j=0;j<n;j++){ for(k=0;k<t;k++){ if(letra[j]==palavra[k]){ palavra[k]=troca[j]; } else if(troca[j]==palavra[k]){ palavra[k]=letra[j]; } } } printf("%s\n",palavra); } return 0; }

This topic has not been answered yet. Be the first!

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