1029. Old keyboard (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, and the text that is actually entered, please list those keys that must be broken.
Input format:
Enter the text that should be entered in 2 rows, and the text that is actually entered. Each paragraph of text is a string of no more than 80 characters, consisting of a A-Z (including large, lowercase), number 0-9, and an underscore "_" (for spaces). The title guarantees that 2 strings are not NULL.
Output format:
Output the broken key in a row in the Order of discovery. Where the English letters only output uppercase, each bad key output only once. The title guarantees that there are at least 1 bad keys.
Input Sample:
7_this_is_a_test_hs_s_a_es
Sample output:
7TI
Submit Code
#include <iostream>#include<cstdio>#include<cmath>#include<cstdlib>#include<cstring>#include<string>#include<algorithm>#defineMAXSIZE 100005using namespacestd;Char*divide (Char*a) { intleng=strlen (a); for(intI=0; i<leng;i++)//lowercase becomes uppercase { if(a[i]>='a'&&a[i]<='Z') A[i]=(Char) (A[i]-('a'-'A')); } intaa[ -]={0}; for(intj=0; j<leng;j++) { if(aa[a[j]]!=0) a[j]='*'; AA[A[J]]++; } /*for (int j=1;j<leng;j++) {for (int i=0;i<j;i++) {if (A[j]==a[i]) a[j]= ' * '; } }*/ returnA;} voidRead (Char*SST,Char*sst1) { inta[ -]={0}; for(intI=0; sst1[i];i++) {A[sst1[i]-0]=1; } for(intI=0; sst[i];i++) { if(a[sst[i]-0]==1) sst[i]='*'; } intj=0; while(sst[j]!=' /') { if(sst[j]!='*') cout<<Sst[j]; J++; } cout<<Endl; }intMain () {Charss[ +];Charss1[ +]; Gets (ss); Char*sst=Divide (ss); //cout<<sst<<endl;gets (SS1); Char*sst1=Divide (SS1); //cout<<sst1<<endl; //Cout<<strlen (SST) << "<<strlen" (sst1) <<endl;Read (SST,SST1); return 0;}
View Code
Programming Ability Test study 1029. Old keyboards (20)