import java.util.*;

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

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] arr = sc.next().toCharArray();
		int length = arr.length;
		ArrayDeque<Boolean> stack = new ArrayDeque<>();
		for (char c : arr) {
		    boolean b = (c == '0');
		    if (stack.size() == 0 || stack.peek() == b) {
		        stack.push(b);
		    } else {
		        stack.pop();
		    }
		}
		System.out.println(length - stack.size());
	}
}
