#include <iostream>
using namespace std;
int main()
{
string s1,s2;
cin>>s1;
cin>>s2;
//jingen
int g=0;
for(int i=0;i<s1.length();i++)
{
for(int j=0;j<s2.length();j++)
{
if(s1[i]==s2[j])
{
g++;
break;
}
}
}
if(g!=s1.length())
{
cout<<"false";
return 0;
}
else cout<<"true";
return 0;
}
由题目数据,两个循环暴力即可,用g对出现在s2里的s1的字符进行计数。若g与s1的长度相等,则true 参与链接

京公网安备 11010502036488号