PAT b 1029 Old keyboard (C + + edition)

Source: Internet
Author: User

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

Idea: After the input, one after the other, if the difference is missing, in order to output convenient, when the lower case letter to uppercase storage, otherwise directly stored, and then in the output to determine whether the front output the same element can be

1 //1029.cpp: Defines the entry point of the console application. 2 //3 4#include"stdafx.h"5#include <iostream>6#include <vector>7#include <string>8#include <cctype>9#include <algorithm>Ten  One using namespacestd; A  - intMain () - { the     stringinput, output; -vector<Char>v; -  - getline (cin, input); + getline (cin, output); -  +      for(inti =0, j=0; I < input.size (); ++i) A     { at         if(Input[i]! = Output[j])//If the difference is the missing -         { -             if(Islower (Input[i]))//if it is lowercase, capitalize -input[i]=ToUpper (Input[i]); -  - V.push_back (Input[i]); in         } -         Else to++J; +     } -  thevector<Char>::iterator I,begin = V.begin (), end =v.end (); *  $      for(i = begin; I! = end; + +)i)Panax Notoginseng     { -         if(Find (Begin, I, *i) = = i)//if it does not appear before the output thecout << *i; +     } A  thecout <<Endl; +  -     return 0; $}



PAT b 1029 Old keyboard (C + + edition)

Related Article

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.