import java.io.*;
import java.util.*;

public class Main {

    static PrintStream out = System.out;

    static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {

    static PrintStream out = System.out;

    static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    }
} Main static PrintStream out = System.out; out System.out System System.out static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    } solve {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    } char[] chs = in.next().toCharArray(); chs in.next().toCharArray() in.next().toCharArray in.next() in.next in int n = chs.length; n chs.length chs chs.length Stack<Character>stack = new Stack<>(); stack new Stack<>() boolean ok = false; ok false for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        } int i = 0; int i = 0; i 0 i < chs.length i chs.length chs chs.length i++ i++ i {
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        } {
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        } if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]); !stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')) !stack.isEmpty() stack.isEmpty() stack.isEmpty stack (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')) stack.peek() == '0' && chs[i] == '1' stack.peek() == '0' stack.peek() stack.peek stack '0' chs[i] == '1' chs[i] chs i '1' (stack.peek() == '1' && chs[i] == '0') stack.peek() == '1' stack.peek() stack.peek stack '1' chs[i] == '0' chs[i] chs i '0' stack.pop() stack.pop stack stack.push(chs[i]) stack.push stack chs[i] chs i System.out.println(n - stack.size()) System.out.println System.out System System.out n - stack.size() n stack.size() stack.size stack Scanner in in public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    } main {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    } Scanner in = new Scanner(new BufferedInputStream(System.in)); in new Scanner(new BufferedInputStream(System.in)) solve(in) solve in String[] args args public class Main {

    static PrintStream out = System.out;

    static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    }
} public class Main {

    static PrintStream out = System.out;

    static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    }
} Main
import java.io.*;
import java.util.*;

public class Main {

    static PrintStream out = System.out;

    static void solve(Scanner in) {
        char[] chs = in.next().toCharArray();
        int n = chs.length;
        Stack<Character>stack = new Stack<>();
        boolean ok = false;
        for(int i = 0; i < chs.length; i++){
            if(!stack.isEmpty() && (stack.peek() == '0' && chs[i] == '1' || (stack.peek() == '1' && chs[i] == '0')))
                    stack.pop();
            else
                    stack.push(chs[i]);
        }
        System.out.println(n - stack.size());
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(new BufferedInputStream(System.in));
        solve(in);
    }
}