#include<bits/stdc++.h>
using namespace std;
char s1[30],s2[30];
int main(){
gets(s1);
gets(s2);
if(strstr(s1,s2)){
cout << s2 << " is substring of " << s1;
} else if(strstr(s2,s1)){
cout << s1 << " is substring of " << s2;
} else{
cout << "No substring";
}
return 0;
}