class Substring {
private static void substrings
(String str
) { if (str.length() >= 1) {
substrings(str.substring(1));
}
}
private static void todasSubstrings
(String str
) { int tam = str.length();
if (tam >= 1) {
substrings(str);
str = str.substring(0, str.length() - 1);
todasSubstrings(str);
}
}
public static void main
(String[] args
) { todasSubstrings("UTFPR");
}
}
Y2xhc3MgU3Vic3RyaW5nIHsKCiAgICBwcml2YXRlIHN0YXRpYyB2b2lkIHN1YnN0cmluZ3MoU3RyaW5nIHN0cikgewogICAgICAgIGlmIChzdHIubGVuZ3RoKCkgPj0gMSkgewogICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oc3RyKTsKICAgICAgICAgICAgc3Vic3RyaW5ncyhzdHIuc3Vic3RyaW5nKDEpKTsKICAgICAgICB9CiAgICB9CgogICAgcHJpdmF0ZSBzdGF0aWMgdm9pZCB0b2Rhc1N1YnN0cmluZ3MoU3RyaW5nIHN0cikgewogICAgICAgIGludCB0YW0gPSBzdHIubGVuZ3RoKCk7CiAgICAgICAgaWYgKHRhbSA+PSAxKSB7CiAgICAgICAgICAgIHN1YnN0cmluZ3Moc3RyKTsKICAgICAgICAgICAgc3RyID0gc3RyLnN1YnN0cmluZygwLCBzdHIubGVuZ3RoKCkgLSAxKTsKICAgICAgICAgICAgdG9kYXNTdWJzdHJpbmdzKHN0cik7CiAgICAgICAgfQogICAgfQoKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgICAgICB0b2Rhc1N1YnN0cmluZ3MoIlVURlBSIik7CiAgICB9Cn0=