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: Wrong Answer)

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string[] args)
        {
            //問題クラスを展開
            ProgramC a = new ProgramC();
            a.main();//実行する

        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            //おおきい方を2倍して1引く。ただし、同じときはa+b
            if(a > b)
                Console.WriteLine(2* a -1);
            else if(a < b)
                Console.WriteLine(2 * b - 1);
            else
                Console.WriteLine(a +b);

        }
    }

    class ProgramB
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            string[] h = Console.ReadLine().Split(' ');
            int count = 0;


            //ダメな旅館数を数える
            for(int i = 1;i < n;i++)
                for (int j = 0; j < i; j++)
                {
                    if (int.Parse(h[i]) < int.Parse(h[j]))
                    {
                        count++;
                        break;
                    }
                    
                }

            //答え出力
            Console.WriteLine(n - count);
            

        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            string s = Console.ReadLine();

            //候補は101010....か0101010しかないので両方実験してみる
            int count1 = 0;
            int count2 = 0;
            //10101010
            for (int i = 1; i < s.Length; i++)
            {
                if (i % 2 == 0)
                    if (s[i] == '0')
                        count1++;
                if (i % 2 == 1)
                    if (s[i] == '1')
                        count1++;
            }

            //010101010
            for (int i = 1; i < s.Length; i++)
            {
                if (i % 2 == 0)
                    if (s[i] == '1')
                        count2++;
                if (i % 2 == 1)
                    if (s[i] == '0')
                        count2++;
            }

            //答えを出力
            Console.WriteLine(Math.Min(count1,count2));

        }


    }


    class ProgramD
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            string[] a = Console.ReadLine().Split(' ');

            long[] dp_u = new long[n];
            long[] dp_d = new long[n];

            dp_u[1] = -(long.Parse(a[0]) + long.Parse(a[1])); 
            dp_d[1] = long.Parse(a[0]) + long.Parse(a[1]);

            for (int i = 2; i < n; i++)
            {
                dp_u[i] = Math.Max(dp_u[i - 1] - long.Parse(a[i]) + 2 * long.Parse(a[i - 1]), dp_d[i - 1] - long.Parse(a[i]) - 2 *long.Parse(a[i - 1]));
                dp_d[i] = Math.Max(dp_u[i - 1] + long.Parse(a[i]), dp_d[i - 1] + long.Parse(a[i]));

            }


            //答を出す
            Console.WriteLine(Math.Max(dp_u[n -1], dp_d[n -1]));

        }

    }

    class ProgramD2
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            string[] a = Console.ReadLine().Split(' ');

            long count = 0;
            int flag = 0;
            long min = 10000000000;
            long sum = 0;

            //いれて0があるか、負の数は何個か、絶対値の最小は何か求めておく
            for (int i = 0; i < n; i++)
            {
                long temp = long.Parse(a[i]);

                if (temp == 0)
                    flag = 1;
                if (temp < 0) 
                    count++;

                sum += Math.Abs(temp);
                min = Math.Min(Math.Abs(temp),min);

            }


            //答を出す
            if(flag == 1 ||count % 2 == 0)
                Console.WriteLine(sum);
            else
                Console.WriteLine(sum - 2 * min);


        }

    }



}