https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem= 1023
The topic is not difficult very simple but to notice ' \ ' attention ' \ ' notice ' \ ' re-say three char ans[] at the time of assignment if there is only one ' \ ' Error "\040"
#include <cstdio>#include<iostream>#include<cstring>#include<cmath>#include<algorithm>#include<vector>#include<queue>using namespacestd;Const Charans[]="' 1234567890-= qwertyuiop[]\\ asdfghjkl; ' zxcvbnm,./";Charbns[ -];intFindCharch) { inti; for(i=1; i<= -; i++){ if(ans[i]==ch) { returni; } } }intMain () {Charch; intt=0, Z; while(SCANF ("%c", &ch)! =EOF) { if(ch!='\ n'&&ch!=' ') {Z=find (CH); bns[++t]=ans[z-1]; } Else if(ch==' ') {bns[++t]=' '; } Else{ for(intj=1; j<=t;j++) printf ("%c", Bns[j]); printf ("\ n"); T=0; Continue; } } return 0; }
The Wertyu of ACM