import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	}
	
	
}


class Stack{
	int data[];
	int top;
	private	int max =100000000;

	Stack(){
		data = new int[max];
	}
	Stack(int size){
		top =0;
		max = size;
		try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		}
	}

	void push(int x)throws RuntimeException{
		if(top >= max)
			throw new RuntimeException();
		data[top] = x;
		top++;
		return ;
	}

	int pop() throws RuntimeException{
		if(top<=0){
			throw new RuntimeException();

		}return data[--top];

	}

	boolean isEmpty(){
		if(top == 0){
			return	true;
		}else{
			return	false;
		}

	}

	int peak(){
		top--;					//pushの時は次の配列にいってるので戻す
		return data[top++];		
	}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	}
	
	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	} main {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ss = sc.next(); ss sc.next() sc.next sc int ans = 0; ans 0 Stack stack = new Stack(); stack new Stack() for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		} int i = 0; int i = 0; i 0 i < ss.length() i ss.length() ss.length ss i++ i++ i {
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		} {
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		} if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			} stack.isEmpty() stack.isEmpty stack {
				stack.push(ss.charAt(i));
			} stack.push(ss.charAt(i)) stack.push stack ss.charAt(i) ss.charAt ss i {
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			} if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				} stack.peak() != ss.charAt(i) stack.peak() stack.peak stack ss.charAt(i) ss.charAt ss i {			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				} ans += 2 ans 2 stack.pop() stack.pop stack {								//追加
					stack.push(ss.charAt(i));
				} stack.push(ss.charAt(i)) stack.push stack ss.charAt(i) ss.charAt ss i System.out.println(ans) System.out.println System.out System System.out ans String[] args args class Stack{
	int data[];
	int top;
	private	int max =100000000;

	Stack(){
		data = new int[max];
	}
	Stack(int size){
		top =0;
		max = size;
		try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		}
	}

	void push(int x)throws RuntimeException{
		if(top >= max)
			throw new RuntimeException();
		data[top] = x;
		top++;
		return ;
	}

	int pop() throws RuntimeException{
		if(top<=0){
			throw new RuntimeException();

		}return data[--top];

	}

	boolean isEmpty(){
		if(top == 0){
			return	true;
		}else{
			return	false;
		}

	}

	int peak(){
		top--;					//pushの時は次の配列にいってるので戻す
		return data[top++];		
	}

} Stack int data[]; data int top; top private	int max =100000000; max 100000000 Stack(){
		data = new int[max];
	} Stack {
		data = new int[max];
	} data = new int[max] data new int[max] max Stack(int size){
		top =0;
		max = size;
		try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		}
	} Stack {
		top =0;
		max = size;
		try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		}
	} top =0 top 0 max = size max size try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		} catch(OutOfMemoryError e){
			max = 0;   
		} OutOfMemoryError e {
			max = 0;   
		} max = 0 max 0 {
			data = new int[max];
		} data = new int[max] data new int[max] max int size size void push(int x)throws RuntimeException{
		if(top >= max)
			throw new RuntimeException();
		data[top] = x;
		top++;
		return ;
	} push {
		if(top >= max)
			throw new RuntimeException();
		data[top] = x;
		top++;
		return ;
	} if(top >= max)
			throw new RuntimeException(); top >= max top max throw new RuntimeException(); new RuntimeException() data[top] = x data[top] data top x top++ top return ; int x x int pop() throws RuntimeException{
		if(top<=0){
			throw new RuntimeException();

		}return data[--top];

	} pop {
		if(top<=0){
			throw new RuntimeException();

		}return data[--top];

	} if(top<=0){
			throw new RuntimeException();

		} top<=0 top 0 {
			throw new RuntimeException();

		} throw new RuntimeException(); new RuntimeException() return data[--top]; data[--top] data --top top boolean isEmpty(){
		if(top == 0){
			return	true;
		}else{
			return	false;
		}

	} isEmpty {
		if(top == 0){
			return	true;
		}else{
			return	false;
		}

	} if(top == 0){
			return	true;
		}else{
			return	false;
		} top == 0 top 0 {
			return	true;
		} return	true; true {
			return	false;
		} return	false; false int peak(){
		top--;					//pushの時は次の配列にいってるので戻す
		return data[top++];		
	} peak {
		top--;					//pushの時は次の配列にいってるので戻す
		return data[top++];		
	} top-- top return data[top++]; data[top++] data top++ top
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		String ss = sc.next();
		
		int ans = 0;
		Stack stack = new Stack();
		
		for(int i = 0;i < ss.length();i++){
			if(stack.isEmpty()){
				stack.push(ss.charAt(i));
			}else{
				if(stack.peak() != ss.charAt(i)){			//01 or 10 なら削除
					ans += 2;
					stack.pop();
				}else{								//追加
					stack.push(ss.charAt(i));
				}
				
			}
		}
		System.out.println(ans);
		
	}
	
	
}


class Stack{
	int data[];
	int top;
	private	int max =100000000;

	Stack(){
		data = new int[max];
	}
	Stack(int size){
		top =0;
		max = size;
		try{
			data = new int[max];
		}catch(OutOfMemoryError e){
			max = 0;   
		}
	}

	void push(int x)throws RuntimeException{
		if(top >= max)
			throw new RuntimeException();
		data[top] = x;
		top++;
		return ;
	}

	int pop() throws RuntimeException{
		if(top<=0){
			throw new RuntimeException();

		}return data[--top];

	}

	boolean isEmpty(){
		if(top == 0){
			return	true;
		}else{
			return	false;
		}

	}

	int peak(){
		top--;					//pushの時は次の配列にいってるので戻す
		return data[top++];		
	}

}
