题解 | #字符串字符匹配#
字符串字符匹配
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;
}
查看17道真题和解析

巨人网络公司福利 91人发布