-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_1152.java
More file actions
42 lines (36 loc) ยท 866 Bytes
/
_1152.java
File metadata and controls
42 lines (36 loc) ยท 866 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
// https://www.acmicpc.net/problem/1152
// ๋จ์ด์ ๊ฐ์
public class _1152 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// sol1
// memory 27208 runtime 200
String[] words = br.readLine().split(" ");
int cnt = words.length;
for(String s : words){
if(s.length() == 0){
cnt--;
}
}
System.out.println(cnt);
// sol2
// memory 20376 runtime 180
// StringTokenizer st = new StringTokenizer(br.readLine(), " ");
// System.out.println(st.countTokens());
}
}
/*
input
The Curious Case of Benjamin Button
output
6
input
Mazatneunde Wae Teullyeoyo
output
3
*/