题解 | #字符串字符匹配#

字符串字符匹配

http://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93

//C++实现,字符串匹配

#include<iostream>
#include<string>
using namespace std;
int main()
{
    string str1,str2;
    while(cin>>str1>>str2)
    {
        int len=str1.length();
        int index=0;
        for(int i=0;i<len;++i)
        {
            if(str2.find(str1[i])!=str2.npos)    index++;
        }
        if(index==len)    cout<<"true"<<endl;
        else    cout<<"false"<<endl;
    }
    return 0;
}

全部评论

相关推荐

1 1 评论
分享
牛客网
牛客企业服务