1033. Old keyboard Typing (20) time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, Yue
The old keyboard has broken a few keys, so when you hit a piece of text, the corresponding characters will not appear. Now give the text that should be entered, as well as the broken keys, the results of the text will be typed?
Input format:
Enter the keys that were broken in 2 rows, and the text that should be entered. The bad key corresponding to the English letter is given in uppercase, and each paragraph is a string of no more than 105 characters. The available characters are the letters [a-Z, A-z], the number 0-9, and the Underscore "_" (for spaces), ",", ".", "-", "+" (on behalf of the upper file key). The title guarantees that the text string entered in line 2nd is not empty.
Note: If the upper file key is broken, the uppercase English letter cannot be typed.
Output format:
Outputs the result text that can be typed in a row. If no word rp is typed, a blank line is output.
Input Sample:
7+ie.7_this_is_a_test.
Sample output:
_hs_s_a_tst
Submit Code
#include <iostream>#include<cstdio>#include<cmath>#include<cstdlib>#include<cstring>#include<string>#include<algorithm>#include<map>#defineMAXSIZE 100005using namespacestd;BOOLIfadd (Char*ss);//voidChangesmall (Char*SS,Char*SS1) { if(Ifadd (SS1) = =true) { intI=0; while(ss[i]!=' /') { if(ss[i]>='A'&&ss[i]<='Z') {Ss[i]='*'; } I++; } }} //determine if there is ' + 'BOOLIfadd (Char*SS) { intI=0;intk=0; while(ss[i]!=' /') { if(ss[i]=='+') {k=1; Break;} Elsei++; } if(I>=strlen (SS))return false; Else return true;}//voidRead (Char*SS,Char*SS1) { intkk=0; inta[maxsize]={0}; for(intI=0; ss[i];i++) {A[ss[i]-0]=1; if(ss[i]>='A'&&ss[i]<='Z') A[ss[i]+ +-0]=1; if(ss[i]>='a'&&ss[i]<='Z') A[ss[i]- +-0]=1; } for(intj=0; ss1[j];j++) { if(a[ss1[j]-0]==1) {ss1[j]='*'; kk++;} } if(Kk==strlen (SS1)) cout<<endl;//determine if it is a blank line, that is, all ' * ' Else{ intk=0; while(ss1[k++]!=' /'){ if(ss1[k-1]!='*') cout<<ss1[k-1]; } cout<<Endl; }} intMain () {CharSs[maxsize]; Gets (ss); CharSs1[maxsize]; Gets (SS1); Changesmall (SS1,SS); //cout<<ss1<<endl;Read (SS,SS1); return 0;}
View Code
Programming Ability Test study 1033. Old keyboard typing (20)