import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.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.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        }

        System.out.println(count * 2);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        }

        System.out.println(count * 2);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        }

        System.out.println(count * 2);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int n = s.length(); n s.length() s.length s char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s int count = 0; count 0 Deque<Character> deque = new ArrayDeque<>(); deque new ArrayDeque<>() for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        } {
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        } if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            } deque.peekFirst() == null deque.peekFirst() deque.peekFirst deque null {
                deque.addFirst(s.charAt(i));
            } deque.addFirst(s.charAt(i)) deque.addFirst deque s.charAt(i) s.charAt s i {
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            } if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                } deque.peekFirst() == s.charAt(i) deque.peekFirst() deque.peekFirst deque s.charAt(i) s.charAt s i {
                    deque.addFirst(s.charAt(i));
                } deque.addFirst(s.charAt(i)) deque.addFirst deque s.charAt(i) s.charAt s i {
                    deque.removeFirst();
                    count++;
                } deque.removeFirst() deque.removeFirst deque 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.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.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.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.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.nextLine();
        int n = s.length();
        char[] c = s.toCharArray();

        int count = 0;

        Deque<Character> deque = new ArrayDeque<>();
        for(int i = 0;i<n;i++){
            if(deque.peekFirst() == null){
                deque.addFirst(s.charAt(i));
            }else{
                if(deque.peekFirst() == s.charAt(i)){
                    deque.addFirst(s.charAt(i));
                }
                else{
                    deque.removeFirst();
                    count++;
                }
            }
        }

        System.out.println(count * 2);
    }
}