过了必关!!!
#include <bits/stdc++.h>
using namespace std;
//fixed << setprecision()
string a, b;
int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> a >> b;
int t = max(a.size(), b.size());
for (int i = 0; i < t; i++)
{
if (a.size() < b.size())
{
if (b[i] == a[0])
{
int n = 0;
for (int j = i, s = 0; j < a.size(); j++, s++)
{
if (b[i] != a[s])
{
n++;
break;
}
}
if (n == 0)
{
cout << a << " is substring of " << b;
return 0;
}
}
}
else
{
if (a[i] == b[0])
{
int n = 0;
for (int j = i, s = 0; j < b.size(); j++, s++)
{
if (a[i] != b[s])
{
n++;
break;
}
}
if (n == 0)
{
cout << b << " is substring of " << a;
return 0;
}
}
}
}
cout << "No substring";
return 0;
}
本人蒟蒻勿喷