标签:
Description
Input
Output
Sample Input
sequence subsequence person compression VERDI vivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter
Sample Output
Yes No Yes No
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> #include<string.h> typedef long long ll; #define N 100005 using namespace std; char str1[N]; char str2[N]; int main() { int len1,len2; int i,j; while(cin>>str1>>str2) { len1=strlen(str1); len2=strlen(str2); int p=0; int t=0; for(i=0;i<len1;i++) { for(j=p;j<len2;j++) { if(str1[i]==str2[j]) { t++; p=j+1; break; } } if(j>=len2) break; } if(t==len1) printf("Yes\n"); else printf("No\n"); } }
标签:
原文地址:http://www.cnblogs.com/Aa1039510121/p/5809209.html