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.
[Reference]
You have designed a new encryption technology. Insert other characters to the characters in the original information in a clever way. Due to copyright issues, we will not detail how characters are inserted. To verify your encryption method, you need to write a program to check whether the information is actually encrypted into the final ciphertext. Characters are case sensitive.
Input:
One or two strings per line, T, and s represent the original message, and t represent the encrypted ciphertext.
Output:
Each output occupies one row. If S is a substring of T, "yes" is output; otherwise, "no" is output ".
Input
The input contains several testcases. Each is specified by two strings S, T of alphanumeric ASCII characters separated by whitespace. input is terminated by EOF.
Output
For each test case output, if S is a subsequence of T.
Sample Input
Sequence subsequence
Person Compression
Verdi vivavittorioemanuelerediitalia
Casedoesmatter
Sample output
Yes
No
Yes
No
My code: ac @ nkacm
# Include
# Include
# Define B 102400
# Define c static char
C s [B], t [B], * s, * t;
Int main ()
{
While (scanf ("% s", & S )! = EOF)
{
Scanf ("% s", & T );
S = s;
T = T;
While (* s! = 0 & * t! = 0)
{
If (* s = * t) s ++;
T ++;
}
If (* s = 0)
Printf ("Yes/N ");
Else
Printf ("No/N ");
}
Return 0;
}