#include <iostream>
using namespace std;
int main()
{
string a, b;
cin >> a >> b;
if (b.size() > a.size())
swap(a, b);
if (a.find(b) >= a.size())
cout << "No substring";
else
cout << b << " is substring of " << a;
return 0;
}