Poj 1936 all in all

Source: Internet
Author: User
All in all

Time limit:1000 MSMemory limit:30000 KB

64-bit integer Io format:% I64d, % i64uJava class name:Main

[Submit] [Status] [discuss]

Descriptionyou 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. inputthe 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. outputfor 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

Question: whether the first string is the second substring is case sensitive or not.

# Include <iostream> # include <string. h> # include <stdio. h> using namespace STD; int main () {long int I, j; // int will exceed char S1 [100000], S2 [100000]; while (scanf ("% s", S1 )! = EOF) {scanf ("% s", S2); long len1 = strlen (S1); long len2 = strlen (S2); I = 0; j = 0; while (true) {if (I = len1) {cout <"yes" <Endl; break;} else if (I <len1 & J = len2) {cout <"no" <Endl; break;} If (S1 [I] = S2 [J]) {I ++; j ++ ;} else J ++;} memset (S1, '\ 0', sizeof (S1); memset (S2,' \ 0', sizeof (S2 ));} return 0 ;}

 

Poj 1936 all in all

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.