From 071ebe919e31e24740702a899a18d3707609073e Mon Sep 17 00:00:00 2001 From: wwan13 Date: Fri, 20 Dec 2024 23:19:28 +0900 Subject: [PATCH] =?UTF-8?q?solve=20:=2011478=20=EC=84=9C=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EB=B6=80=EB=B6=84=20=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=EC=97=B4=EC=9D=98=20=EA=B0=9C=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- java/src/boj11478/Main.java | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 java/src/boj11478/Main.java 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); + } + } +}