Created
June 10, 2022 14:25
-
-
Save moosongsong/46b309998d3603b1784b1eeb1e744582 to your computer and use it in GitHub Desktop.
백준 11656
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package silver_4; | |
import java.io.*; | |
import java.util.Comparator; | |
import java.util.TreeSet; | |
public class NUM_11656 { | |
public static void main(String[] args) throws IOException { | |
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); | |
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out)); | |
TreeSet<String> set = new TreeSet<>(Comparator.comparing(o -> o)); | |
String fullString = bufferedReader.readLine(); | |
for (int i = 0; i < fullString.length(); i++) { | |
set.add(fullString.substring(i)); | |
} | |
for (String str : set){ | |
bufferedWriter.write(str + '\n'); | |
} | |
bufferedWriter.flush(); | |
bufferedReader.close(); | |
bufferedWriter.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment