import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int N = S.length();
    ArrayList<Character> al = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    }
    int ans = 0;
    int i = 0;
    while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int N = S.length();
    ArrayList<Character> al = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    }
    int ans = 0;
    int i = 0;
    while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int N = S.length();
    ArrayList<Character> al = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    }
    int ans = 0;
    int i = 0;
    while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int N = S.length();
    ArrayList<Character> al = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    }
    int ans = 0;
    int i = 0;
    while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int N = S.length(); N S.length() S.length S ArrayList<Character> al = new ArrayList<>(); al new ArrayList<>() for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      al.add(S.charAt(i));
    } {
      al.add(S.charAt(i));
    } al.add(S.charAt(i)) al.add al S.charAt(i) S.charAt S i int ans = 0; ans 0 int i = 0; i 0 while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    } i < al.size() - 1 i al.size() - 1 al.size() al.size al 1 {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    } if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      } al.get(i) != al.get(i + 1) al.get(i) al.get al i al.get(i + 1) al.get al i + 1 i 1 {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } al.remove(i) al.remove al i al.remove(i) al.remove al i ans += 2 ans 2 i = 0 i 0 {
        i++;
      } i++ i System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int N = S.length();
    ArrayList<Character> al = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      al.add(S.charAt(i));
    }
    int ans = 0;
    int i = 0;
    while (i < al.size() - 1) {
      if (al.get(i) != al.get(i + 1)) {
        al.remove(i);
        al.remove(i);
        ans += 2;
        i = 0;
      } else {
        i++;
      }
    }
    System.out.println(ans);
  }
}