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

namespace AtCoder.ABC.ABC120
{
    class C
    {
        public static int Result(string data)
        {

            //Console.WriteLine("Result::" + data);
            if (data.Length < 2)
            {
                return 0;
            }
            var res = 0;
            for (int i = 0; i < data.Length - 1; i++)
            {
                if (
                    (data[i] == '0' && data[i + 1] == '1')
                    || (data[i] == '1' && data[i + 1] == '0')
                    )
                {
                    var pre = new string(data.Take(i).ToArray());
                    var ee = new string(data.Skip(i + 2).ToArray());
                    //Console.WriteLine(pre);
                    //Console.WriteLine(ee);
                    var next = pre + ee;

                    //Console.WriteLine(data + " " + i);
                    //Console.WriteLine(next);
                    var tmp = Result(next);

                    res = Math.Max(tmp + 2, res);
                }
            }
            //Console.WriteLine("Result::" + data + " " + res);
            return res;
        }


        public static void Solve()
        {
            var input = Console.ReadLine();
            var result = Result(input);
            Console.WriteLine(result);
        }

        static void Main(string[] args)
        {
            Solve();
        }
    }
}
