import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   }
} import java.util.*; util.* java public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   }
} Main public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   } main {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] arr = sc.next().toCharArray(); arr sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc ArrayDeque<Character> deq = new ArrayDeque<>(); deq new ArrayDeque<>() int count = 0; count 0 for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		} char c arr {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		} {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		} if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    } deq.size() == 0 || c == deq.peek() deq.size() == 0 deq.size() deq.size deq 0 c == deq.peek() c deq.peek() deq.peek deq {
		        deq.push(c);
		    } deq.push(c) deq.push deq c {
		        deq.pop();
		        count++;
		    } deq.pop() deq.pop deq count++ count 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);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   }
} public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   }
} Main
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		ArrayDeque<Character> deq = new ArrayDeque<>();
		int count = 0;
		for (char c : arr) {
		    if (deq.size() == 0 || c == deq.peek()) {
		        deq.push(c);
		    } else {
		        deq.pop();
		        count++;
		    }
		}
		System.out.println(count * 2);
   }
}
