From 05a39b7c348e62b66c162c4004ca9daea780c28b Mon Sep 17 00:00:00 2001 From: zinnnn37 Date: Fri, 26 Sep 2025 19:30:37 +0900 Subject: [PATCH] =?UTF-8?q?[20250926]=20BOJ=20/=20G5=20/=20=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=EC=97=B4=20=EB=B3=B5=EC=82=AC=20/=20=EA=B9=80?= =?UTF-8?q?=EB=AF=BC=EC=A7=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\354\227\264 \353\263\265\354\202\254.md" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "zinnnn37/202509/26 BOJ G5 \353\254\270\354\236\220\354\227\264 \353\263\265\354\202\254.md" diff --git "a/zinnnn37/202509/26 BOJ G5 \353\254\270\354\236\220\354\227\264 \353\263\265\354\202\254.md" "b/zinnnn37/202509/26 BOJ G5 \353\254\270\354\236\220\354\227\264 \353\263\265\354\202\254.md" new file mode 100644 index 00000000..ef44b4a9 --- /dev/null +++ "b/zinnnn37/202509/26 BOJ G5 \353\254\270\354\236\220\354\227\264 \353\263\265\354\202\254.md" @@ -0,0 +1,40 @@ +```java +import java.io.*; + +public class BJ_2195_문자열_복사 { + + private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + + private static String needle, haystack; + + public static void main(String[] args) throws IOException { + sol(); + } + + private static void sol() throws IOException { + needle = br.readLine(); + haystack = br.readLine(); + + int cnt = 0; + int start = 0; + int len = haystack.length(); + while (start < len) { + int end = start + 1; + + while (end <= len && needle.indexOf(haystack.substring(start, end)) != -1) { + end++; + } + + start = end - 1; + cnt++; + } + + bw.write(cnt + "\n"); + bw.flush(); + bw.close(); + br.close(); + } + +} +``` \ No newline at end of file