uva10340——子序列

簡單題,注意數組開大點即可。
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    char  Str[100000],str[100000];
    while(scanf("%s%s",str,Str)!=EOF)
    {
        int len1,len2,count=0;
        len1=strlen(Str);
        len2=strlen(str);
        int i,j;
        for(i=0;i<len2;i++)
      {
       for(j=0;j<len1;j++)
       {
           if(str[i]==Str[j])
           {
               count++;
               Str[j]=0;
               break;
           }
           else
           {
               Str[j]=0;
           }
       }
    }
    if(count==len2)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    memset(str,0,sizeof(str));
    memset(Str,0,sizeof(Str));
    }
    return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章