import java.util.Scanner;
import java.util.Stack;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  }
} import java.util.Scanner; Scanner java.util import java.util.Stack; Stack java.util public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int removals = 0; removals 0 Stack<Character> stack = new Stack<>(); stack new Stack<>() for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    } char c s.toCharArray() s.toCharArray s {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    } {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    } if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      } stack.empty() || stack.peek() == c stack.empty() stack.empty stack stack.peek() == c stack.peek() stack.peek stack c stack.push(c) stack.push stack c {
        stack.pop();
        removals += 2;
      } stack.pop() stack.pop stack removals += 2 removals 2 System.out.println(removals) System.out.println System.out System System.out removals String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  }
} Main
import java.util.Scanner;
import java.util.Stack;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();

    int removals = 0;

    Stack<Character> stack = new Stack<>();
    for (char c : s.toCharArray()) {
      if (stack.empty() || stack.peek() == c)
        stack.push(c);
      else {
        stack.pop();
        removals += 2;
      }
    }

    System.out.println(removals);
  }
}