It is not entirely clear why some lines are repeated several times. Explain, please.
public static void main(String[] args) { String s = "Мама мыла раму"; for (int i = 0; i < 10; i++) { System.out.println(s.substring(i).trim()); } } And the output will be:
Mom washed the frame
ama soap frame
ma soap frame
and washed the frame
soap frame
soap frame
...