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
Using a map to record bad keys, there is a test data point is no bad key Ah, WA twice
#include <bits/stdc++.h>#defineMAXN 100000+50using namespaceStd;map<Char,BOOL>vistable;stringstr;stringInvalidword;intMain () {BOOLFlag =false; Getline (CIN, Invalidword); intLen =invalidword.length (); for(inti =0; i < Len; ++i) {Vistable[invalidword[i]]=true; } CIN>>str; Len=str.length (); for(inti =0; i < Len; ++i) { //Alpha if(Isalpha (Str[i])) {if(Isupper (Str[i])) {//A- z if(!vistable[str[i]] &&!vistable['+']) {flag=true; printf ("%c", Str[i]); } } Else{ //A- z if(!Vistable[toupper (Str[i])) {Flag=true; printf ("%c", Str[i]); } } } //otherwise Else{ if(!Vistable[str[i]]) {Flag=true; printf ("%c", Str[i]); } } } if(!flag) {printf ("\ n"); } return 0;}
Capouis ' CODE
pat-basic-1033-old keyboard Typing