class Substring {
public static void todasSubstrings
(String str
) { for (int j
= str.
length(); j
>= 0; j
--) for (int i
= 0; i
< j
; i
++) System.
out.
println(str.
substring(i, j
)); }
public static void main
(String[] args
) { todasSubstrings("UTFPR");
}
}
//https://pt.stackoverflow.com/q/323222/101
Y2xhc3MgU3Vic3RyaW5nIHsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCB0b2Rhc1N1YnN0cmluZ3MoU3RyaW5nIHN0cikgewogICAgICAgIGZvciAoaW50IGogPSBzdHIubGVuZ3RoKCk7IGogPj0gMDsgai0tKSBmb3IgKGludCBpID0gMDsgaSA8IGo7IGkrKykgU3lzdGVtLm91dC5wcmludGxuKHN0ci5zdWJzdHJpbmcoaSwgaikpOwogICAgfQogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIHRvZGFzU3Vic3RyaW5ncygiVVRGUFIiKTsKICAgIH0KfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMzIzMjIyLzEwMQ==