publicstaticvoidsuffixOfArray()throws Exception { BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String str = in.readLine(); String[] arr = new String[str.length()];
for (int i = 0; i<str.length(); i++) { arr[i] = str.substring(i); } Arrays.sort(arr); for (String s : arr) { out.write(s+'\n'); } out.flush(); out.close();; in.close(); } }