1 #include<iostream> 2 #include<string> 3 #include<sstream> 4 using namespace std; 5 6 void great(string& word) 7 { 8 for(int i = 0; i != word.size(); ++i) 9 if(word[i] >= 'a' && word[i] <= 'z') 10 { 11 word[i] = word[i] - 'a' + 'A'; 12 } 13 } 14 inline bool rule(string& word) 15 { 16 great(word); 17 if(word.size() < 3 || word == "AND" || word == "FOR" || word == "THE") 18 return false; 19 return true; 20 } 21 int main() 22 { 23 int n; 24 cin >> n; 25 bool flag = true; 26 string word, str, res; 27 stringstream ss; 28 cin.ignore(); 29 cout << endl; 30 for(int i = 0; i < n; ++i) 31 { 32 getline(cin, str); 33 ss << str; 34 while(ss >> word) 35 { 36 if(rule(word)) 37 res += word[0]; 38 word = ""; 39 } 40 cout << res; 41 if(i < n-1) 42 cout << endl; 43 ss.clear(); 44 res = ""; 45 } 46 return 0; 47 } 48 49 /* 50 5 51 Association for Computer Machinery 52 Institute of Electrical Engineers 53 SUN YAT SEN UNIVERSITY 54 THE LORD OF The Rings 55 netease 56 */