forked from gojung/AlgorithmStudy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava_1289.java
More file actions
23 lines (22 loc) · 767 Bytes
/
java_1289.java
File metadata and controls
23 lines (22 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//SWEA 1289 ¿øÀçÀÇ ¸Þ¸ð¸® º¹±¸Çϱâ
import java.io.*;
public class java_1289 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for (int t = 1; t <= T; t++) {
char[] s = br.readLine().toCharArray();
char pivot = '0';
int ctr = 0;
for (int i = 0; i < s.length; i++) {
if(pivot != s[i]) {
ctr++;
pivot = s[i];
}
}
sb.append("#").append(t).append(" ").append(ctr).append("\n");
}
System.out.print(sb);
}
}