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

namespace AtCorder_C
{
    class Program
    {
        static void Main(string[] args)
        {
            bool[] s = Console.ReadLine().Select(x => x == '1').ToArray();
            int o = (s.Length - Get2(s.ToList()).Max(x => x.Count()));
            Console.WriteLine(o);
        }
        
        public static IEnumerable<List<bool>> Get2(List<bool> s)
        {
            bool f = false;
            for (int i = 0; i < s.Count - 1; i++)
            {
                if (s[i] != s[i + 1])
                {
                    f = true;
                    yield return Get2(s.Where((_, z) => z != i && z != i + 1).ToList())
                        .OrderByDescending(x => x.Count)
                        .First();
                }
            }
            if (!f) {
                yield return s;
            }
        }
    }
}
