Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions zinnnn37/202509/26 BOJ G5 문자열 복사.md
Original file line number Diff line number Diff line change
@@ -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();
}

}
```