import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    }

} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc ArrayDeque<Character> dq = new ArrayDeque<>(); dq new ArrayDeque<>() int count = 0; count 0 for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        } int i =0; int i =0; i 0 S.length() > i S.length() S.length S i i++ i++ i {
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        } {
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        } char c = S.charAt(i); c S.charAt(i) S.charAt S i if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            } dq.isEmpty() || dq.getFirst() == c dq.isEmpty() dq.isEmpty dq dq.getFirst() == c dq.getFirst() dq.getFirst dq c {
                dq.addFirst(c);
            } dq.addFirst(c) dq.addFirst dq c {
                dq.removeFirst();
                count++;
            } dq.removeFirst() dq.removeFirst dq count++ count System.out.println(count*2) System.out.println System.out System System.out count*2 count 2 String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    }

} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    }

} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        ArrayDeque<Character> dq = new ArrayDeque<>();
        int count = 0;

        for(int i =0; S.length() > i; i++){
            char c = S.charAt(i);
            if(dq.isEmpty() || dq.getFirst() == c){
                dq.addFirst(c);
            }else{
                dq.removeFirst();
                count++;
            }
            
        }
        System.out.println(count*2);

    }

}