POJ 1936

简介: /* 字符串匹配,(模式串 主串) 区分大小写 */ #include #include #include using namespace std; const int N = 100010; char str1[N],str2[N]; bool is_match...
/*
字符串匹配,(模式串   主串)
区分大小写
*/ 
#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;
}
        
     

  

目录
相关文章
|
5月前
poj-1611-The Suspects
poj-1611-The Suspects
26 0
|
5月前
POJ-2245-Lotto
POJ-2245-Lotto
25 0
POJ 2027 No Brainer
POJ 2027 No Brainer
108 0
POJ 1012 Joseph
Joseph Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 53862   Accepted: 20551 Description The Joseph's problem is notoriously known.
839 0
|
C语言
poj 2503 查字典
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language.
863 0
|
算法 数据建模 机器学习/深度学习
poj1273Drainage Ditches
1 #include 2 /* 3 题意:就是寻找从源点到汇点的最大流! 4 要注意的是每两个点的流量可能有多个,也就是说有重边,所以要把两个点的所有的流量都加起来 5 就是这两个点之间的流量了! 6 ...
848 0