diff --git "a/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" "b/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" new file mode 100644 index 00000000..72e26b4e --- /dev/null +++ "b/khj20006/202502/12 BOJ P3 \353\263\204\353\213\244\354\244\204.md" @@ -0,0 +1,99 @@ +```java + +import java.util.*; +import java.io.*; + +class Node{ + Node[] next; + int cnt; + Node(){ + next = new Node[26]; + cnt = 0; + } +} + +class Trie{ + Node root; + Trie(){ + root = new Node(); + } + void insert(String str) { + Node now = root; + for(char i:str.toCharArray()) { + if(now.next[i-'a'] == null) now.next[i-'a'] = new Node(); + now = now.next[i-'a']; + now.cnt++; + } + } +} + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static long nextLong() {return Long.parseLong(st.nextToken());} + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + static Trie trie; + static int N; + static long[][] count; + static long[] dp; + static long mod = (long)1e9 + 7; + static String S; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + } + + static void ready() throws Exception{ + + trie = new Trie(); + N = Integer.parseInt(br.readLine()); + for(int i=0;i