import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
Scanner in
= new Scanner
(System.
in); String labels
= in.
nextLine(); String labelsMixed
= in.
nextLine(); String[] labelsArray
= labels.
split(" "); StringBuilder sb = new StringBuilder();
LinkedHashMap
<String, String
> labelsFound
= new LinkedHashMap
<String, String
>();
for (String s
: labelsMixed.
split("")) { sb.append(s);
String labelFound
= findLabel
(labelsArray, sb.
toString()); if (labelFound != null) {
labelsFound.put(sb.toString(), labelFound);
sb = new StringBuilder();
}
}
for (Map.
Entry<String, String
> entry
: labelsFound.
entrySet()) { System.
out.
print(entry.
getKey().
concat(" ")); }
for (Map.
Entry<String, String
> entry
: labelsFound.
entrySet()) { System.
out.
print(entry.
getValue().
concat(" ")); }
}
String[] anagramArray
= anagram.
split("");
wordArray = word.split("");
if (Arrays.
deepEquals(wordArray, anagramArray
)) { return word;
}
}
return null;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpwdWJsaWMgY2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24gewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwogICAgICAgIFN0cmluZyBsYWJlbHMgPSBpbi5uZXh0TGluZSgpOwogICAgICAgIFN0cmluZyBsYWJlbHNNaXhlZCA9IGluLm5leHRMaW5lKCk7CiAgICAgICAgU3RyaW5nW10gbGFiZWxzQXJyYXkgPSBsYWJlbHMuc3BsaXQoIiAiKTsKICAgICAgICBTdHJpbmdCdWlsZGVyIHNiID0gbmV3IFN0cmluZ0J1aWxkZXIoKTsKICAgICAgICBMaW5rZWRIYXNoTWFwPFN0cmluZywgU3RyaW5nPiBsYWJlbHNGb3VuZCA9IG5ldyBMaW5rZWRIYXNoTWFwPFN0cmluZywgU3RyaW5nPigpOwoKCiAgICAgICAgZm9yIChTdHJpbmcgcyA6IGxhYmVsc01peGVkLnNwbGl0KCIiKSkgewogICAgICAgICAgICBzYi5hcHBlbmQocyk7CiAgICAgICAgICAgIFN0cmluZyBsYWJlbEZvdW5kID0gZmluZExhYmVsKGxhYmVsc0FycmF5LCBzYi50b1N0cmluZygpKTsKICAgICAgICAgICAgaWYgKGxhYmVsRm91bmQgIT0gbnVsbCkgewogICAgICAgICAgICAgICAgbGFiZWxzRm91bmQucHV0KHNiLnRvU3RyaW5nKCksIGxhYmVsRm91bmQpOwogICAgICAgICAgICAgICAgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBmb3IgKE1hcC5FbnRyeTxTdHJpbmcsIFN0cmluZz4gZW50cnkgOiBsYWJlbHNGb3VuZC5lbnRyeVNldCgpKSB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnQoZW50cnkuZ2V0S2V5KCkuY29uY2F0KCIgIikpOwogICAgICAgIH0KCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCk7CgogICAgICAgIGZvciAoTWFwLkVudHJ5PFN0cmluZywgU3RyaW5nPiBlbnRyeSA6IGxhYmVsc0ZvdW5kLmVudHJ5U2V0KCkpIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludChlbnRyeS5nZXRWYWx1ZSgpLmNvbmNhdCgiICIpKTsKICAgICAgICB9Cgl9CgkKCXByaXZhdGUgc3RhdGljIFN0cmluZyBmaW5kTGFiZWwoU3RyaW5nW10gYXJyYXksIFN0cmluZyBhbmFncmFtKSB7CiAgICAgICAgU3RyaW5nW10gYW5hZ3JhbUFycmF5ID0gYW5hZ3JhbS5zcGxpdCgiIik7CiAgICAgICAgU3RyaW5nW10gd29yZEFycmF5OwoKICAgICAgICBmb3IgKFN0cmluZyB3b3JkIDogYXJyYXkpIHsKICAgICAgICAgICAgd29yZEFycmF5ID0gd29yZC5zcGxpdCgiIik7CgogICAgICAgICAgICBBcnJheXMuc29ydChhbmFncmFtQXJyYXkpOwogICAgICAgICAgICBBcnJheXMuc29ydCh3b3JkQXJyYXkpOwoKICAgICAgICAgICAgaWYgKEFycmF5cy5kZWVwRXF1YWxzKHdvcmRBcnJheSwgYW5hZ3JhbUFycmF5KSkgewogICAgICAgICAgICAgICAgcmV0dXJuIHdvcmQ7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuIG51bGw7CiAgICB9Cn0=