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

class Program
{
    static int Solve(string str)
    {
        int k = 0;
        for (int i = 1; i < str.Length; i++)
        {
            if (str[i] == str[i - 1])
            {
                k = Math.Max(k, 1 + Solve(str.Substring(0, i - 1) + str.Substring(i + 1, str.Length - i - 1)));
                i++;
            }
        }
        return k;
    }
    public static void Main()
    {
        string s = Console.ReadLine();
        Console.WriteLine(2 * Solve(s));
    }
}