舊鍵盤上壞了幾個鍵,因而在敲一段文字的時候,對應的字符就不會出現。如今給出應該輸入的一段文字、以及實際被輸入的文字,請你列出確定壞掉的那些鍵。spa
輸入格式:code
輸入在2行中分別給出應該輸入的文字、以及實際被輸入的文字。每段文字是不超過80個字符的串,由字母A-Z(包括大、小寫)、數字0-九、以及下劃線「_」(表明空格)組成。題目保證2個字符串均非空。blog
輸出格式:內存
按照發現順序,在一行中輸出壞掉的鍵。其中英文字母只輸出大寫,每一個壞鍵只輸出一次。題目保證至少有1個壞鍵。字符串
輸入樣例:7_This_is_a_test _hs_s_a_es輸出樣例:
7TI
1 #include<stdio.h> 2 #include<math.h> 3 #include<stdlib.h> 4 #include<string.h> 5 #include<algorithm> 6 using namespace std; 7 8 int main() 9 { 10 int hashtable[150] = {}; 11 int i, j, len1, len2; 12 char s1[100], s2[100]; 13 gets(s1); 14 gets(s2); 15 len1 = strlen(s1); 16 len2 = strlen(s2); 17 for(i = 0; i < len1; i++) 18 { 19 char c1 = s1[i]; 20 for(j = 0; j < len2; j++) 21 { 22 char c2 = s2[j]; 23 if(c1 >= 'a' && c1 <= 'z') 24 c1 = c1 + 'A' - 'a'; 25 if(c2 >= 'a' && c2 <= 'z') 26 c2 = c2 + 'A' - 'a'; 27 if(c1 == c2) 28 { 29 break; 30 } 31 } 32 if(j == len2 && hashtable[c1] == 0) 33 { 34 printf("%c", c1); 35 hashtable[c1] = 1; 36 } 37 } 38 printf("\n"); 39 return 0; 40 }