子串寻找(find函数)
2023-07-26 10:03:47
发布于:浙江
6阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin>>a>>b;
if(a.find(b)!=-1) cout<<b<<" is substring of "<<a;
else if(b.find(a)!=-1) cout<<a<<" is substring of "<<b;
else cout<<"No substring";
return 0;
}
这里空空如也
有帮助,赞一个