-
[java]백준 접미사 배열 11656번알고리즘 문제풀이/백준(자바) 2023. 4. 26. 23:34
코드
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class BOJ_11656 { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s =in.next(); List<String> q=new ArrayList<String>(); //s에서 요소 하나씩 버리면서 for (int i = 0; i < s.length(); i++) { //리스트에 저장 q.add(s.substring(i)); } Collections.sort(q); //배열 사전순으로 정렬 for (String i : q) { //리스트 하나씩 출력 System.out.println(i); } in.close(); } } //문자 자르기 //정렬 //리스트요소(반복문)
링크
https://www.acmicpc.net/problem/11656
'알고리즘 문제풀이 > 백준(자바)' 카테고리의 다른 글
[java]백준 수 정렬하기 3 10989번 (0) 2023.04.28 [java]백준 A+B 26711번 (0) 2023.04.27 [java]백준 평균 점수 10039번 (0) 2023.04.25 [java]백준 설탕 배달 2839번 (0) 2023.04.24 [java]백준 돌 게임 2 9656번 (0) 2023.04.23