[Water]Hdu 5284 wyh2000 and a string problem
#include <cstdio> #include <cstring> using namespace std; const int MAXN=10000000+5; char a[MAXN]; int t; char b[3]={'w','y','h'}; int main() { scanf("%d",&t); getchar(); while(t--){ gets(a); for(int i=0;a[i+1];++i)if(a[i]=='v'&&a[i+1]=='v')a[i]='w'; int i=0,j=0; while(i<len){ if(a[i]==b[j]){ j++; } if(j==3)break; i++; } if(j==3)printf("Yes\n"); else printf("No\n"); } }