题解 | #字符串字符匹配#
字符串字符匹配
https://www.nowcoder.com/practice/22fdeb9610ef426f9505e3ab60164c93
// HJ81-2 字符串字符匹配.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s1, s2;
while (cin >> s1 >> s2)
{
int count = 0;
if (s1.size() > s2.size())swap(s1, s2);
for (int i = 0; i < s1.size(); i++)
{
for (int j = 0; j < s2.size(); j++)
{
if (s1[i] == s2[j])
{
count++;
break;
}
}
}
if (count == s1.size())
{
cout << "true" << endl;
}
else
{
cout << "false" << endl;
}
}
return 0;
}
传音控股公司福利 344人发布
