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)