How Many Blocks
A block is a maximal run of equal characters. Count the blocks of the binary string.
Input: one line with a binary string.
Output: the number of blocks.
Constraints:
- 1 ≤ |S| ≤ 105
Sample Tests
Input 1
0011011
Output 1
4
Input 2
1111
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.