pat-basic-1033-old keyboard Typing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.