哎!很简单一道题,提交总是runtime error ,改了十几分钟,到最后终于该出来了,数组开的太小了
You have devised a new encryption technique which encodes a message by inserting between its charactersrandomly generated strings in a clever way. Because of pending patent issues we will not discuss indetail 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 finalstring.Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can removecharacters 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 ASCIIcharacters separated by whitespace. Input is terminated by EOF.OutputFor each test case output, if s is a subsequence of t.Sample Inputsequence subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatterSample OutputYesNoYesNo
#include<stdio.h>
#include<string.h>
char s[100002],s1[100002];
int main()
{
int i,j,len,len1,t=0;
while(scanf("%s%s",s,s1)!=EOF)
{
t=0;i=0;
len=strlen(s);
len1=strlen(s1);
for(j=0;j<len1;j++)
{
if(s1[j]==s[i]&&i<len)
{
t++;
i++;
// continue;
}
}
if(t==len)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}