UVa 10340 All in All

来源:互联网 发布:mac jenkins 安装 编辑:程序博客网 时间:2024/06/18 03:47

10340    All in All


You have devised anew encryption technique which encodes a message by inserting between itscharacters randomly generated strings in a clever way. Because of pendingpatent issues we will not discuss in detail how the strings are generated andinserted into the original message. To validate your method, however, it isnecessary to write a program that checks if the message is really encoded inthe final string.

Given two strings s and t, you have to decide whether s is asubsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.


Input


The inputcontains several testcases. Each is specified by two strings s,tof alphanumeric ASCII charactersseparated by whitespace. Input is terminated by EOF.


Output


For each testcase output, if s is a subsequence of t.


Sample Input


sequencesubsequence person compression

VERDIvivaVittorioEmanueleReDiItalia caseDoesMatter CaseDoesMatter


Sample Output


Yes

No

Yes

No


#include<stdio.h>#include<string.h>char s[100010],t[1000010];int main(){int i,j,log,lens,lent;while(scanf("%s %s",s,t)!=EOF){lens=strlen(s);lent=strlen(t);//printf("%s lens=%d\n%s lent=%d\n",s,lens,t,lent);log=0;for(i=0;i<lent;i++)              if(log<lens)                        {if(t[i]==s[log]) log++;}             else break;          if(log==lens) printf("Yes\n");          else printf("No\n");}return 0;} 


0 0
原创粉丝点击