思路:直接先找字符串中有没有三个大写的字符,三个大写的字符就满足了名字是三个字,然后再用string类中的find方法找子串,如果存在就返回第一个找到的子串的位置,否则返回-1.
#include <bits/stdc++.h>
using namespace std;
int n;
int main()
{
while(cin>>n){
while(n--){
string s; cin>>s;
int cnt = 0;
for(int i=0;i<s.length();i++){
if(s[i]>='A'&&s[i]<='Z')
cnt++;
}
if(cnt == 3){
if(s.find("Ting")!=-1&&s.find("Li")!=-1){
cout<<s<<endl;
}
}
}
}
return 0;
}