import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    }
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    }
} Main public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    } main {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    } try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        } {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        } Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner Stack<Boolean> stack = new Stack<>(); stack new Stack<>() int removed = 0; removed 0 for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            } {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            } char c = s.charAt(i); c s.charAt(i) s.charAt s i stack.push(c != '0') stack.push stack c != '0' c '0' while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                } stack.size() > 1 stack.size() stack.size stack 1 {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                } boolean top = stack.pop(); top stack.pop() stack.pop stack boolean second = stack.pop(); second stack.pop() stack.pop stack if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    } top != second top second {
                        removed+=2;
                    } removed+=2 removed 2 {
                        stack.push(second);
                        stack.push(top);
                        break;
                    } stack.push(second) stack.push stack second stack.push(top) stack.push stack top break; System.out.println(removed) System.out.println System.out System System.out removed String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            String s = scanner.next();
            Stack<Boolean> stack = new Stack<>();
            int removed = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                stack.push(c != '0');
                while(stack.size() > 1) {
                    boolean top = stack.pop();
                    boolean second = stack.pop();
                    if (top != second) {
                        removed+=2;
                    } else {
                        stack.push(second);
                        stack.push(top);
                        break;
                    }
                }
            }
            System.out.println(removed);
        }
    }
}
