0
已解决
朱谨政
新手守护
新手守护
1094 字符串的包含问题
经验值:800
时间限制:1000毫秒
内存限制:128MB
题目描述 Deion
给定2个字符串,若其中S1字符串包含在另一个S2字符串中,则称S1包含于S2。
输入描述 Input Deion
输入为2行:
第一行为字符串S1;
第二行为字符串S2。
长度都不超过100。
输出描述 Output Deion
若S1包含于S2,则输出 (S1) is included in (S2) ;
若S2包含于S1,则输出 (S2) is included in (S1) ;
否则,输出 No including
样例输入 Sample Input
abcd aababcdaabb
样例输出 Sample Output
abcd is included in aababcdaabb
#include<iostream>
#include<cstdio>
int main(){
int a,b;
string s1;
string s2;
getline(cin,s1);
getline(cin,s2);
a=s1.size();
b=s2.size();
if(s1.find(s2,0)!=-1){
cout<<s1<<" is included in "<<s2;
}else if(s2.find(s1,0)!=-1){
cout<<s2<<" is included in "<<s1;
}else{
cout<<"No including";
}
return 0;
}