All in all
Time limit:1000 ms |
|
Memory limit:30000 K |
Total submissions:27537 |
|
Accepted:11274 |
Description
You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. to validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.
Given two strings S and T, you have to decide whether s is a subsequence of T, I. e. if you can remove characters from t such that the concatenation of the remaining characters is S.
Input
The input contains several testcases. Each is specified by two strings S, T of alphanumeric ASCII characters separated by whitespace. The length of S and T will no more than 100000.
Output
For each test case output "yes", if S is a subsequence of T, otherwise output "no ".
Sample Input
sequence subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatter
Sample output
YesNoYesNo
Source
Ulm Local 2002
Water...
Is to judge whether the string ST1 is a string of st2.
#include <iostream>using namespace std;int main(){char st1[100000],st2[100000]; __int64 l1,l2,i,j;while(cin>>st1>>st2){ i=0;j=0;l1=strlen(st1);l2=strlen(st2);while(1){if(i==l1){printf("Yes\n");break;}if(i<l1&&j==l2){printf("No\n");break;}if(st1[i]==st2[j]){i++;j++;}elsej++;}}return 0;}
Poj 1936 all in all (string)