using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
    public static void Main()
    {
        Console.WriteLine(Console.ReadLine().ToCharArray().GroupBy(c => c).Select(g => g.Count()).Min() * 2);
        Console.ReadLine();
    }
}