import java.util.Scanner;
import java.util.ArrayDeque;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  }
} import java.util.Scanner; Scanner java.util import java.util.ArrayDeque; ArrayDeque java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  } main {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    } in.hasNext() in.hasNext in {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    } String S = in.next(); S in.next() in.next in ArrayDeque<Character> stack = new ArrayDeque<Character>(); stack new ArrayDeque<Character>() for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S ++i ++i i {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      } {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      } char cube = S.charAt(i); cube S.charAt(i) S.charAt S i if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        } stack.isEmpty() stack.isEmpty stack {
          stack.push(cube);
        } stack.push(cube) stack.push stack cube if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        } cube == '1' && stack.peek() == '0' cube == '1' cube '1' stack.peek() == '0' stack.peek() stack.peek stack '0' {
          stack.pop();
        } stack.pop() stack.pop stack if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        } cube == '0' && stack.peek() == '1' cube == '0' cube '0' stack.peek() == '1' stack.peek() stack.peek stack '1' {
          stack.pop();
        } stack.pop() stack.pop stack {
          stack.push(cube);
        } stack.push(cube) stack.push stack cube System.out.println(S.length() - stack.size()) System.out.println System.out System System.out S.length() - stack.size() S.length() S.length S stack.size() stack.size stack String[] args args public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  }
} Main
import java.util.Scanner;
import java.util.ArrayDeque;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      String S = in.next();
      ArrayDeque<Character> stack = new ArrayDeque<Character>();

      for (int i = 0; i < S.length(); ++i) {
        char cube = S.charAt(i);
        if (stack.isEmpty()) {
          stack.push(cube);
        } else if (cube == '1' && stack.peek() == '0') {
          stack.pop();
        } else if (cube == '0' && stack.peek() == '1') {
          stack.pop();
        } else {
          stack.push(cube);
        }
      }

      System.out.println(S.length() - stack.size());
    }
  }
}