标签:
1 #include <iostream> 2 #include <string.h> 3 using namespace std; 4 char s[100002]; 5 char t[100002]; 6 int main() { 7 8 while(cin>>s>>t){ 9 int length1=strlen(s); 10 int length2=strlen(t); 11 int i=0,j=0; 12 for(i=0,j=0;i<length1&&j<length2;){ 13 if(s[i]==t[j]){ 14 i++; 15 j++; 16 }else{ 17 j++; 18 } 19 } 20 if(i==length1) 21 cout<<"Yes"<<endl; 22 else 23 cout<<"No"<<endl; 24 } 25 return 0; 26 }
附:
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 29592 | Accepted: 12269 |
Description
Input
Output
Sample Input
sequence subsequence person compression VERDI vivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter
Sample Output
Yes No Yes No
标签:
原文地址:http://www.cnblogs.com/sdxk/p/4691377.html