一、题目:
描述
判断短字符串中的所有字符是否在长字符串中全部出现。
请注意本题有多组样例输入。
输入描述:
输入两个字符串。第一个为短字符串,第二个为长字符串。两个字符串均由小写字母组成。
输出描述:
如果短字符串的所有字符均在长字符串中出现过,则输出true。否则输出false。
二、输入输出示例:
三、代码:
#include<iostream>
using namespace std;
#include<string>
int main()
{
string s1,s2;
while(cin>>s1>>s2){
int count = 0;
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;
}
}
system("pause");
return 0;
}