Problem:
Score : 300 points

Problem Statement

N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.

The i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.

You want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.

At least how many tiles need to be repainted to satisfy the condition?

Constraints

1 \leq |S| \leq 10^5

S_i is 0 or 1.

Input

Input is given from Standard Input in the following format:

S

Output

Print the minimum number of tiles that need to be repainted to satisfy the condition.

Sample Input 1

000

Sample Output 1

1

The condition can be satisfied by repainting the middle tile white.

Sample Input 2

10010010

Sample Output 2

3

Sample Input 3

0

Sample Output 3

0

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC124 {
	class ABC124_C {
		static void Main(string[] args) {
			var input = Console.ReadLine();
			var N = input.Length;

			var start0 = CreateNBinary(N, 0);
			var start1 = CreateNBinary(N, 1);
		
			var bin = Convert.ToUInt32(input, 2);
			var bin0 = Convert.ToUInt32(start0, 2);
			var bin1 = Convert.ToUInt32(start1, 2);
			var res0 = BitCount(bin ^ bin0);
			var res1 = BitCount(bin ^ bin1);

			Console.WriteLine(res0 > res1 ? res1 : res0);

		}

		private static uint BitCount(uint bits) {
			bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);    //  2bitごとに計算
			bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);    //  4bitごとに計算
			bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);    //  8bitごとに計算
			bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);    //  16ビットごとに計算   
			return (bits & 0x0000ffff) + (bits >> 16);    //  32ビット分を計算   
		}

		private static string CreateNBinary(int n, int start) {
			var sb = new StringBuilder(start.ToString());
			for (int i = 0; i < n-1; i++) {
				if(sb[i] == '0') {
					sb.Append('1');
					continue;
				}

				if(sb[i] == '1') {
					sb.Append('0');
					continue;
				}
			}

			return sb.ToString();
		}
	}
}