SWEA_1213) String
SWEA
# D3
1213) String (19.10.15)
문제 링크 (SW Expert Academy)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import java.io.*;
public class Solution {
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
for(int test=1;test<=10;test++) {
int n = Integer.parseInt(br.readLine());
String s = br.readLine();
String st = br.readLine();
int sn = s.length();
int cnt = 0;
for(int i=0;i<=st.length()-sn;i++) {
String ans = st.substring(i, i+sn);
if(s.equals(ans)) cnt = cnt+1;
}
bw.write("#" + test + " " + cnt + "\n");
}
bw.flush();
bw.close();
}
}
| cs |
댓글
댓글 쓰기