1 solutions

  • 0
    @ 2026-1-31 10:40:44
    #include<bits/stdc++.h>
    using namespace std;
    string s1,s2;
    int n=0;
    int main(){
    	cin>>s1>>s2;
    	int len1 = s1.size(),len2 = s2.size();
    	if(len1>=len2)
    		if(s1.find(s2)!=-1) n=1;
    	else
    		if(s2.find(s1)!=-1) n=2;
    	if(n==1)
    		cout<<s2+" is substring of "+s1;
    	else if(n==2)
    		cout<<s1+" is substring of "+s2;
    	else cout<<"No substring";
    	return 0;
    }
    

    Information

    ID
    345
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    10
    Tags
    # Submissions
    3
    Accepted
    3
    Uploaded By