题目描述
只要一个字符串中包含大写“GLB”,高老板就认为这是一个GLB串。现在给你一些字符串,请你帮高老板判断这些字符串是不是GLB串。
输入
首先是一个整数T,表示T行数据,每行一个字符串(只包括大小写字母),长度小于100.
输出
如果是高老板串输出YES,否则输出NO。
样例输入
3 GLBSHIGEmaiIPADMINI4detuhao wobushiGlb hahaha
样例输出
YES NO NO
分析:暴力匹配!利用string的内置函数find即可。


#include <iostream> #include <algorithm> #include <cstdio> #include <string> using namespace std; string tmp; int T; void init(){ cin>>T; } void solve(){ while(T--){ cin>>tmp; if(tmp.find("GLB")==string::npos)cout<<"NO"<<endl; else cout<<"YES"<<endl; } } int main(int argc, char *argv[]) { init(); solve(); return 0; }