Animate
Time Limit:1000MS Memory Limit:32768K
Description:
Have you ever Googled the “Animate”?Tyr Googles the “Animate” one day, and find out 245 match records.But he doesn't know whether the number 245 is correct or not. Here comes the problem A: Give you documentation,your task is to find out whether this documentation contains the word “Animate” or not.Input:
The input will consist of several case of input.The first line is an integer N which gives the case number.The next part has N cases.Every case follows this format: Line 1: The beginning of the documentation: #Doc Line 2 to m-1: The contest of documentation,this may be consists of several lines.Every line contains less than 100 characters,and the total characters of one documentation are less than 1000. Line m:The end of the documentation:#EndOutput:
For each input case,your program should print an answer in a single line.If the documentation contains “Animate”, please print “Yes”, else print “No”. In Google, we know the match is case insensitive,which means “animate” is also a match of “Animate”. In this problem we just take care of the alphabet characters, please ignore other characters.Sample Input:
2 #Doc 1Shanghai Jiaotong University=>Cappuccino 2Tsinghua University=>JHVHSecond Place 3Zhejiang University=>ZJU Focus 4Peking University=>PKU_MonkeyKing 5ZhongShan (Sun Yat-sen) University=>ZSU Pegasus 6Renmin University of China=>rruucc 7Zhejiang University=>Titan 8Zhejiang University of Technology=>Animate #End #Doc AngryHair #End
Sample Output:
Yes No
code:
1 /* 2 本题需要注意的点在于过滤掉除字母外的所有字符,包括空格和回车。 3 */ 4 #include <iostream> 5 #include <string> 6 using namespace std; 7 8 int main() 9 { 10 int N; 11 cin >> N; 12 string null; 13 getline(cin, null); 14 for (int i = 0; i < N; i++) { 15 string animate_exsit = "No"; 16 string s, aim; 17 getline(cin, s); 18 for (;getline(cin, s) && s != "#End";) { 19 for (int j = 0; j < s.length(); j++) { 20 if (isalpha(s[j])) { 21 aim += tolower(s[j]); 22 } 23 } 24 if (aim.find("animate") != string::npos) { 25 animate_exsit = "Yes"; 26 } 27 } 28 cout << animate_exsit << endl; 29 } 30 }