import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    } main {
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    } BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in)); stdR new BufferedReader(new InputStreamReader(System.in)) String str = stdR.readLine(); str stdR.readLine() stdR.readLine stdR int count = 0; count 0 int zero = 0; zero 0 int one = 0; one 0 for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        } int i = 0 ; int i = 0 ; i 0 i < str.length() i str.length() str.length str i++ i++ i {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        } {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        } if(str.charAt(i) == '0')zero++; str.charAt(i) == '0' str.charAt(i) str.charAt str i '0' zero++ zero if(str.charAt(i) == '1')one++; str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' one++ one int min = Math.min(zero, one); min Math.min(zero, one) Math.min Math zero one if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            } min > 0 min 0 {
                zero -= min;
                one -= min;
                count += min * 2;
            } zero -= min zero min one -= min one min count += min * 2 count min * 2 min 2 System.out.println(count) System.out.println System.out System System.out count String args[] args public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String args[]) throws Exception{
        BufferedReader stdR = new BufferedReader(new InputStreamReader(System.in));
        String str = stdR.readLine();
        int count = 0;
        int zero = 0;
        int one = 0;
        for(int i = 0 ; i < str.length() ; i++) {
            if(str.charAt(i) == '0')zero++;
            if(str.charAt(i) == '1')one++;
            int min = Math.min(zero, one);
            if(min > 0) {
                zero -= min;
                one -= min;
                count += min * 2;
            }
        }
        System.out.println(count);
    }
}
