import java.util.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    }
} Main public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc StringBuilder sb = new StringBuilder(s); sb new StringBuilder(s) int idx = 0; idx 0 int count = 0; count 0 while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        } idx < sb.length()-1 idx sb.length()-1 sb.length() sb.length sb 1 {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        } if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            } sb.charAt(idx) != sb.charAt(idx+1) sb.charAt(idx) sb.charAt sb idx sb.charAt(idx+1) sb.charAt sb idx+1 idx 1 {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } count += 2 count 2 sb.deleteCharAt(idx+1) sb.deleteCharAt sb idx+1 idx 1 sb.deleteCharAt(idx) sb.deleteCharAt sb idx if (idx != 0) idx--; idx != 0 idx 0 idx-- idx {
                idx++;
            } idx++ idx 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 {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    }
} public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        StringBuilder sb = new StringBuilder(s);
        int idx = 0;
        int count = 0;

        while (idx < sb.length()-1) {
            if (sb.charAt(idx) != sb.charAt(idx+1)) {
                count += 2;
                sb.deleteCharAt(idx+1);
                sb.deleteCharAt(idx);
                if (idx != 0) idx--;
            } else {
                idx++;
            }
        }
        System.out.println(count);
    }
}