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

namespace abc120_c
{
  class Program
  {
    static void Main(string[] args)
    {
      var s = ConsoleInput.Read();
      var sLength = s.Length;

      var checkRegex = new Regex("01|10");

      while (checkRegex.IsMatch(s))
      {
        s = checkRegex.Replace(s, "");
      }

      Console.WriteLine(sLength - s.Length);
    }
  }

  class ConsoleInput
  {
    private static readonly Queue<string> fieldBuffer = new Queue<string>();

    public static string Read()
    {
      if (fieldBuffer.Count == 0)
      {
        foreach (var field in Console.ReadLine().Split())
        {
          fieldBuffer.Enqueue(field);
        }
      }

      return fieldBuffer.Dequeue();
    }

    public static int ReadAsInt() => int.Parse(Read());
    public static long ReadAsLong() => long.Parse(Read());
    public static double ReadAsDouble() => double.Parse(Read());

    public static string[] ReadAsStringArray(long n)
    {
      var array = new string[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = Read();
      }

      return array;
    }

    public static int[] ReadAsIntArray(long n)
    {
      var array = new int[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsInt();
      }

      return array;
    }

    public static long[] ReadAsLongArray(long n)
    {
      var array = new long[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsLong();
      }

      return array;
    }
    public static double[] ReadAsDoubleArray(long n)
    {
      var array = new double[n];

      for (var i = 0; i < n; i++)
      {
        array[i] = ReadAsDouble();
      }

      return array;
    }
  }
}