60分求助
  • 板块B2118 验证子串
  • 楼主heheya
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/10/18 12:45
  • 上次更新2023/11/2 13:06:35
查看原帖
60分求助
970434
heheya楼主2023/10/18 12:45

60分求助

#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    int c;
    cin>>a>>b;
    if(a.size()>b.size()||a.size()>20&&b.size()>20){
    cout<<"No substring1";
    return 0;
    }
    for(int i=0;i<b.size();i++){
        for(int j=0;j<b.size();j++){
            if(b[j]==a[i]) c=1;
            else if(b[j]!=a[i]) c=0;
        }
    }
    if(c==1) cout<<a<<" is substring of "<<b<<endl;
    else cout<<"No substring"<<endl;
    return 0;
}
2023/10/18 12:45
加载中...