using System;

class C
{
	static void Main()
	{
		var s = Console.ReadLine();
		var n = s.Length;
		for (var t = s; (t = s.Replace("01", "").Replace("10", "")) != s; s = t) ;
		Console.WriteLine(n - s.Length);
	}
}
