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

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var str = Console.ReadLine();
		var s = new int[str.Length];
		for(int i = 0; i < s.Length; i++)
		{
			s[i] = (int)(str[i]-'0');
		}
		long wa = 0;
		for(;;)
		{
			bool changed=false;
			for(int i = 0; i < s.Length-1; i++)
			{
				int nextIndex = i;
				if(s[i]==2)
					continue;
					
				while(nextIndex < s.Length && 2==s[++nextIndex]);
				
				if(nextIndex >= s.Length)
					break;
				
				if(s[i]==2 || s[nextIndex]==2)
					continue;
					
				if(s[i] != s[nextIndex])
				{
					s[i]=2;
					s[nextIndex]=2;
					wa+=2;
					changed=true;
				}
		}
			if(!changed) break;
		}
		Console.WriteLine(wa);
		
	}
	

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}

