标签:
Description
Input
Output
Sample Input
sequence subsequence person compression VERDI vivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter
Sample Output
Yes No Yes No
#include <iostream> #include <cstring> #include <cstdio> using namespace std; char s[100005],t[100005]; int data[100005]; int main() { int flag,k,m; while(scanf("%s%s",s,t)!=-1) { int lens,lent; lens=strlen(s); lent=strlen(t); k=0; flag=0; for(int i=0;i<lent;i++) { if(t[i]==s[0]) data[k++]=i; } for(int i=0;i<k;i++) { m=0; for(int j=data[i];j<lent;j++) { if(t[j]==s[m]) m++; if(m==lens) { flag=1;break; } } if(flag) break; } if(flag) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/nefu929831238/p/5911743.html