import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
public static boolean check(StringBuilder a, StringBuilder b) {
if(a.length()==b.length()) {
for(int i = 0; i < a.length(); i++) {
if(a.charAt(i) != b.charAt(i)) return false;
}
}
return true;
}
{
int n, m, z;
StringBuilder a = new StringBuilder();
StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder();
Scanner in
= new Scanner
(System.
in); a.append( in.nextLine());
b.append( in.nextLine());
StringBuilder d = new StringBuilder(b);
n = b.length();
m = a.length();
c = new StringBuilder(a.substring(m - n, m));
if(a.toString().contains(b.toString()) != true) {
for (int i = 1; i<=n && check(b,c) != true; i++) {
b.delete(n - i,m);
c.delete(0, 1);
}
z = c.length();
d.delete(0,z);
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgYm9vbGVhbiBjaGVjayhTdHJpbmdCdWlsZGVyIGEsIFN0cmluZ0J1aWxkZXIgYikgewoJCWlmKGEubGVuZ3RoKCk9PWIubGVuZ3RoKCkpIHsKCQkJZm9yKGludCBpID0gMDsgaSA8IGEubGVuZ3RoKCk7IGkrKykgewoJCQkJaWYoYS5jaGFyQXQoaSkgIT0gYi5jaGFyQXQoaSkpIHJldHVybiBmYWxzZTsKCQkJfQoJCX0KCXJldHVybiB0cnVlOwoJfQoJCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlpbnQgbiwgbSwgejsKCQlTdHJpbmdCdWlsZGVyIGEgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwoJCVN0cmluZ0J1aWxkZXIgYiA9IG5ldyBTdHJpbmdCdWlsZGVyKCk7CgkJU3RyaW5nQnVpbGRlciBjID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKCQlTY2FubmVyIGluID0g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