import java.util.*;

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

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] S = sc.next().toCharArray(); S sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int one = 0; one 0 int zero = 0; zero 0 int answer = 0; answer 0 for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        } char c S {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        } {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        } if (c == '1') {
                one++;
            } else {
                zero++;
            } c == '1' c '1' {
                one++;
            } one++ one {
                zero++;
            } zero++ zero if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            } one > 0 && zero > 0 one > 0 one 0 zero > 0 zero 0 {
                answer += 2;
                one--;
                zero--;
            } answer += 2 answer 2 one-- one zero-- zero System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    }
} Main
import java.util.*;

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

        char[] S = sc.next().toCharArray();
        int one = 0;
        int zero = 0;
        int answer = 0;

        for (char c : S) {
            if (c == '1') {
                one++;
            } else {
                zero++;
            }
            if (one > 0 && zero > 0) {
                answer += 2;
                one--;
                zero--;
            }
        }

        System.out.println(answer);
        sc.close();
    }
}