CCF_ 201409-3_字符串匹配

水。

 

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;

int main()
{
    char a[105],b[105];
    cin >> a;
    strcpy(b,a);
    strlwr(b);
    int flag,n;
    cin >> flag >> n;
    while(n--)
    {
        char temp[105],temp2[105];
        cin >> temp;
        strcpy(temp2,temp);
        if(!flag)
        {
            strlwr(temp2);
            if(strstr(temp2,b)) cout << temp << endl;
        }
        else
        {
            if(strstr(temp,a)) cout << temp << endl;
        }
    }
    return 0;
}

 

posted @ 2016-09-06 19:40  zzzzzzzzhu  阅读(310)  评论(0编辑  收藏  举报