#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
char a[500];
char b[500];
int n = 0, i = 0;
while ((a[n ++] = getchar()) != '\n');
while ((b[i ++] = getchar()) != '\n');
a[-- n] = '\0';
b[-- i] = '\0';
if (strstr(a, b))
{
cout << b << " is substring of " << a << endl;
}
else if (strstr(b, a))
{
cout << a << " is substring of " << b << endl;
}
if (!(strstr(b, a) || strstr(a, b)))
{
cout << "No substring" << endl;
}
return 0;
}
排版可能很垃圾,大佬勿喷。