-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ1439.java
More file actions
29 lines (25 loc) · 834 Bytes
/
BOJ1439.java
File metadata and controls
29 lines (25 loc) · 834 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class BOJ1439 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String S = br.readLine();
String[] arr = S.split("0");
String[] arr2 = S.split("1");
int count1 = 0;
int count2 = 0;
for(int i = 0; i < arr.length; i++){
if(arr[i].contains("1")){
System.out.println(arr[i]);
count1++;
}
}
for(int i = 0; i < arr2.length; i++){
if(arr2[i].contains("0")){
count2++;
}
}
System.out.println(count1 > count2 ? count2 : count1);
}
}