using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var chars = Console.ReadLine().ToCharArray().ToList();
        var i = 0;
        var cnt = 0;
        while (true)
        {
            if (chars.Count == 1)
            {
                break;
            }
            if (chars[i] == '0')
            {
                if (chars[i+1] == '1')
                {
                    if (chars.Count == 2)
                    {
                        cnt += 2;
                        break;
                    }
                    chars.RemoveRange(i, 2);
                    cnt += 2;
                    
                    if (i == chars.Count)
                    {
                        break;
                    }
                    i = 0;
                }
                else
                {
                    i++;
                }
            }
            else if (chars[i] == '1')
            {
                if (chars[i+1] == '0')
                {
                    if (chars.Count == 2)
                    {
                        cnt += 2;
                        break;
                    }
                    chars.RemoveRange(i, 2);
                    cnt += 2;
                    if (i == chars.Count)
                    {
                        break;
                    }
                    i = 0;
                }
                else
                {
                    i++;
                }   
            }
            
            if (chars.Count == 2)
            {
                if (chars[0] == chars[1])
                {
                    break;
                }
            }
            
            if (i == chars.Count - 1)
            {
                if (chars[i] == chars[i+1])
                {
                    break;
                }
            }
        }

        Console.WriteLine(cnt);
    }
}
