All in all-University of Ulm Local contest

Source: Internet
Author: User

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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.