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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    }

    static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    }
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    }

    static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int ans = solve(s); ans solve(s) solve s System.out.println(ans) System.out.println System.out System System.out ans String[] args args static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    } solve {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    } Stack<Character> stack = new Stack<>(); stack new Stack<>() for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        } {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        } if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            } stack.isEmpty() stack.isEmpty stack {
                stack.add(s.charAt(i));
                continue;
            } stack.add(s.charAt(i)) stack.add stack s.charAt(i) s.charAt s i continue; if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } s.charAt(i) == '0' s.charAt(i) s.charAt s i '0' {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                } stack.peek() == '0' stack.peek() stack.peek stack '0' {
                    stack.add(s.charAt(i));
                } stack.add(s.charAt(i)) stack.add stack s.charAt(i) s.charAt s i {
                    stack.pop();
                } stack.pop() stack.pop stack {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                } stack.peek() == '1' stack.peek() stack.peek stack '1' {
                    stack.add(s.charAt(i));
                } stack.add(s.charAt(i)) stack.add stack s.charAt(i) s.charAt s i {
                    stack.pop();
                } stack.pop() stack.pop stack return s.length() - stack.size(); s.length() - stack.size() s.length() s.length s stack.size() stack.size stack String s s public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    }

    static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    }

    static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        int ans = solve(s);
        System.out.println(ans);
    }

    static int solve(String s) {
        Stack<Character> stack = new Stack<>();

        for (int i = 0; i < s.length(); i++) {
            if (stack.isEmpty()) {
                stack.add(s.charAt(i));
                continue;
            }

            if (s.charAt(i) == '0') {
                if (stack.peek() == '0') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            } else {
                if (stack.peek() == '1') {
                    stack.add(s.charAt(i));
                } else {
                    stack.pop();
                }
            }
        }
        return s.length() - stack.size();
    }
}
