N<=10,字符串长度<=50.
1 #include<cstdio>
2 #include<cstring>
3 int n,l,i,j;
4 char ch[60],name[]={‘R‘,‘K‘,‘Y‘};
5 int main(){
6 scanf("%d",&n);
7 while(n--){
8 scanf("%s",ch);
9 for(i=j=0;ch[i]&&name[j];i++)
10 if(ch[i]==name[j]) j++;
11 if(j==3) printf("YES\n");
12 else printf("NO\n");
13 }
14 return 0;
15 }