import java.util.ArrayList;
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	} main {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Character>al = new ArrayList<Character>(); al new ArrayList<Character>() String s = sc.next(); s sc.next() sc.next sc int p = s.length(); p s.length() s.length s for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			} int i = 0; int i = 0; i 0 i < p i p i++ i++ i {
			char c = s.charAt(i);
			al.add(c);
			} {
			char c = s.charAt(i);
			al.add(c);
			} char c = s.charAt(i); c s.charAt(i) s.charAt s i al.add(c) al.add al c int temp; temp int count = 0; count 0 do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0); temp == 0 temp 0 {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		} temp = -1 temp -1 1 for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			} int i = al.size() -1; int i = al.size() -1; i al.size() -1 al.size() al.size al 1 i >= 1 i 1 i-- i-- i {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			} {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			} if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				} al.get(i) != al.get(i - 1) al.get(i) al.get al i al.get(i - 1) al.get al i - 1 i 1 {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				} al.remove(i) al.remove al i al.remove(i-1) al.remove al i-1 i 1 temp = 0 temp 0 count++ count break; System.out.println(count * 2) System.out.println System.out System System.out count * 2 count 2 String[] args args public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	}

} public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayList<Character>al = new ArrayList<Character>();
		
		String s = sc.next();
		int p = s.length();
		for(int i = 0; i < p ;i++) {
			char c = s.charAt(i);
			al.add(c);
			}
		
		int temp;
		int count = 0;
		do {
			
			temp = -1;
			for(int i = al.size() -1; i >= 1 ; i--) {
				if(al.get(i) != al.get(i - 1)) {
					al.remove(i);
					al.remove(i-1);
					temp = 0;
					count++;
					break;
				}
			}
		
		}while(temp == 0);
		
		System.out.println(count * 2);
		
		
	}

}
