#include <iostream>
using namespace std;
string s, b;
int main() {
cin >> b >> s;
if (s.length() > b.length() ) {
swap(s, b);
}
for (int i = 0; i <= s.length(); i++) {
int l = 0;
for (int j = 0; i < b.length(); j++) {
if (s[i + j] == b[j])
l++;
else
break;
}
if (l == s.size()) {
cout << b << " is substring of " << s << endl;
return 0;
}
}
cout << "No substring";
return 0;
}