#include<bits/stdc++.h>
using namespace std;
int main() {
char x[30];
char y[30];
int t=0;
cin.getline(x,30);
cin.getline(y,30);
int lx=strlen(x);
int ly=strlen(y);
if(lx>ly) {
for(int j=0; j<lx; j++) {
t=0;
if(x[j]==y[0]) {
for(int k=j; k<j+ly; k++) {
if(x[k]==y[t]) {
t=t+1;
}
}
if(t==ly) {
for (int i=0; i<ly; i++) {
printf("%c",y[i]);
}
printf(" is substring of ");
for(int i=0; i<lx; i++) {
printf("%c",x[i]);
}
return 0;
}
}
}
printf("No substring");
} else if(lx<ly) {
for(int j=0; j<ly; j++) {
t=0;
if(y[j]==x[0]) {
for(int k=j; k<j+lx; k++) {
if(y[k]==x[t]) {
t=t+1;
}
}
if(t==lx) {
for (int i=0; i<lx; i++) {
printf("%c",x[i]);
}
printf(" is substring of ");
for(int i=0; i<ly; i++) {
printf("%c",y[i]);
}
return 0;
}
}
}
printf("No substring");
} else if(lx==ly) {
for(int i=0; i<lx; i++) {
if(x[i]==y[i]) {
t=t+1;
}
}
if(t==lx) {
for (int i=0; i<lx; i++) {
printf("%c",x[i]);
}
printf(" is substring of ");
for(int i=0; i<ly; i++) {
printf("%c",y[i]);
}
return 0;
}
else{
printf("No substring");
}
}
return 0;
}