s1=input()
s2=input()
if s1 in s2:print(s1+" is substring of "+s2)
elif s2 in s1:print(s2+" is substring of "+s1)
else:print("No substring")