POJ 1936

/*

字符串匹配,(模式串   主串)

区分大小写

*/ 

#include <cstdio>

#include <cstring>

#include <cstdlib>

using namespace std;

const int N = 100010;

char str1[N],str2[N];

bool is_match()

{

    int i,j;

    if(strlen(str1)>strlen(str2))

        return false;    

    for(j=i=0;str1[i]!='\0'&&str2[j]!='\0';j++)

    if(str1[i]==str2[j])

        i++;

    if(str1[i]=='\0')

        return true;

    return false;

}   

int main()

{

    while(scanf("%s %s",str1,str2)!=EOF)

    {

        bool flag = is_match();

        if(flag)

            puts("Yes");

        else

            puts("No");

        memset(str1,0,sizeof(str1));

        memset(str2,0,sizeof(str2));

    }

    return 0;

}

        

     

  

你可能感兴趣的:(poj)