80分求助
查看原帖
80分求助
1129515
hello141219楼主2024/3/24 15:06

编译器:C++14(GCC9)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string s1,s2;
    getline(cin,s1);
    getline(cin,s2);
    if(s1.find(s2)!=string::npos){
        cout<<s2<<" is substring of "<<s1;
    }else if(s2.find(s1)!=string::npos){
        cout<<s1<<" is substring of "<<s2;
    }else{
        cout<<"No substring";
    }
    return 0;
}
2024/3/24 15:06
加载中...