백준

백준 11655 - Java

으엉어엉 2024. 9. 21. 13:20
728x90

 

import java.util.Arrays;
import java.util.Scanner;

public class SuffixArray {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();

        String[] suffixes = new String[S.length()];

        for (int i = 0; i < S.length(); i++) {
            suffixes[i] = S.substring(i);
        }

        Arrays.sort(suffixes);

        for (String suffix : suffixes) {
            System.out.println(suffix);
        }
    }
}
728x90

'백준' 카테고리의 다른 글

백준 6588 - Java  (0) 2024.09.21
백준 2609 - Java  (0) 2024.09.21
백준 10824 - Java  (0) 2024.09.21
백준 11655 -Java  (0) 2024.09.21
백준 10820 - Java  (0) 2024.09.21