#CCBCHMOT0000034. Hai chữ số kề nhau bằng nhau (Equal Adjacent Decimal Digits)
Hai chữ số kề nhau bằng nhau (Equal Adjacent Decimal Digits)
Equal Adjacent Decimal Digits
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given nonnegative integer n in standard decimal notation without leading zeros, count neighboring equal digit pairs. Overlapping pairs are counted, so 111 contains two pairs.
Input
One nonnegative integer n.
Output
Print the number of equal adjacent digit pairs.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
12233
Output
2
Explanation
The pairs 2-2 and 3-3 match, hence answer 2.
Example 2
Input
111
Output
2
Explanation
Positions (1,2) and (2,3) both match.