P22152 [CodeChef] GROUPS
普及-
题目描述

Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

There are $N$ seats in a row. You are given a string $S$ with length $N$; for each valid $i$, the $i$-th character of $S$ is '0' if the $i$-th seat is empty or '1' if there is someone sitting in that seat.

Two people are friends if they are sitting next to each other. Two friends are always part of the same group of friends. Can you find the total number of groups?

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains a single string $S$.

------ Output ------
For each test case, print a single line containing one integer ― the number of groups.

------ Constraints ------
$1 ≤ T ≤ 50$
$1 ≤ N ≤ 10^{5}$

------ Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------
4

000

010

101

01011011011110
----- Sample Output 1 ------
0

1

2

4
----- explanation 1 ------
Example case 1: Since all seats are empty, the number of groups is $0$.

Example case 2: Since only one seat is occupied, the number of groups is $1$.

Example case 3: Here, two seats are occupied, but since they are not adjacent, the people sitting on them belong to different groups.

Example case 4: Here, we have $4$ groups of friends with size $1$, $2$, $2$ and $4$ respectively. That is, first group is sitting at $2$nd seat, second group at $4$th and $5$th seat, third group at $7$th and $8$th seat and fourth group at $10$th to $13$th seat.

输入格式

见题面

输出格式

见题面

样例输入
4 000 010 101 01011011011110
样例输出
0 1 2 4