All in All You have devised a new encryption technique which encodes a message by inserting between itscharacters randomly generated strings in a clever way. Because of pending patent issues we willnot discuss in detail how the strings are generated and inserted into the original message. Tovalidate your method, however, it is necessary to write a program that checks if the message isreally encoded in the final string. Given two strings s and t, you have to decide whether s is a subsequence of t, ie if you canremove characters from t such that the concatenation of the remaining characters is s. Input SpecificationThe 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 SpecificationFor each test case output, if s is A Subsequence of T. Sample InputSequence Subsequence
Person compression
Verdi vivavitorioemanuelediitalia
Casedoesmatter CasesMatter
Sample Outputyes
NO
YES
NO
This code is generally general but more easy to understand #include
#include
Using namespace std;
void main ()
{
Char s [100];
While (cin >> s)
{
INT LEN = Strlen (s);
CHAR CH;
CIN >> CH;
INT IDX = 0;
While (ch! = '/ n')
{
IF (ch == s [idx])
IDX ;
Cin.get (CH);
}
IF (IDX == LEN)
COUT << "YES" << endl;
Else
COUT << "no" << endl;
}
}