diff --git a/java/src/boj11478/Main.java b/java/src/boj11478/Main.java new file mode 100644 index 0000000..c45168c --- /dev/null +++ b/java/src/boj11478/Main.java @@ -0,0 +1,33 @@ +package boj11478; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashSet; +import java.util.Set; + +public class Main { + + private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + + public static void main(String[] args) { + String input = readLine(); + Set set = new HashSet<>(); + + for (int i = 0; i < input.length(); i++) { + for (int j = i + 1; j <= input.length(); j++) { + set.add(input.substring(i, j)); + } + } + + System.out.println(set.size()); + } + + private static String readLine() { + try { + return reader.readLine(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +}