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 not more than5 characters in a string. 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.
Note: The input to the bad key may be an empty string, so this cannot be read with scanf, otherwise there is a case that cannot be used.
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100000char Change (char a); bool Legal (char a); int main () {char wrong[n+1],first[n+1]; Gets (wrong); Gets (first); BOOL Shift=false; if (STRCHR (wrong, ' + ')!=0) shift=true; int I,length=strlen (first); if (strlen (wrong) ==0) {printf ("%s\n", first); return 0; } for (i=0;i<length;i++) {char temp; Temp=first[i]; if (! Legal (temp)) continue; if (shift) {if (temp-' A ' >=0) && (temp-' Z ' <=0)) continue; else {temp=change (temp); if (STRCHR (wrong,temp) ==0) printf ("%c", First[i]); }} else {Temp=change (temp); if (STRCHR (wrong,temp) ==0) printf ("%c", First[i]); }} printf ("\ n"); System ("pause"); return 0; }bool Legal (char a) {if ((A-' a ' >=0) && (A-' z ' <=0)) return true; else if ((A-' a ' >=0) && (A-' Z ' <=0)) return true; else if ((A-' 0 ' >=0) && (A-' 9 ' <=0)) return true; else if (A-' _ ' ==0) return true; else if (A-', ' ==0 ') return true; else if (A-'. ') ==0) return true; else if (A-'-' ==0) return true; else if (A-' + ' ==0) return true; else return false; }char Change (char a) {if ((A-' a ' >=0) && (A-' z ' <=0) return a-32; else return A; }
1033. Old keyboard Typing