#include<bits/stdc++.h>
using namespace std;
int main()
{
char d[55], c[55];
gets(d);
gets(c);
int flag = 0,len1 = strlen(d),len2 = strlen(c);
int k = 0;
if (strstr(d,c) != NULL)
{
printf("%s is substring of %s", c, d);
}
else if (strstr(c,d) != NULL)
{
printf("%s is substring of %s", d, c);
}
else
{
printf("No substring");
}
return 0;
}