#include <bits/stdc++.h>
using namespace std;
struct Node {
  int value;
  struct Node *next;
  struct Node *prev;
};
Node node[100010] = {0};
int main() {
  string s;
  cin >> s;
  int ans = 0;
  int length = s.length();
  for (int i = 0; i < length; ++i) {
    node[i].value = s[i] - '0';
    node[i].next = &node[i + 1];
    if (i != 0) {
      node[i].prev = &node[i - 1];
    }
  }
  node[length - 1].next = NULL;
  Node head = {0};
  head.next = &node[0];
  node[0].prev = &head;
  Node *n = head.next;
  while (n != NULL) {
    if (n->next == NULL) {
      break;
    }
    if (n->value != n->next->value) {
      ans += 2;
      n->prev->next = n->next->next;
      if (n->next->next != NULL) {
        n->next->next->prev = n->prev;
      }
      n = head.next;
      continue;
    }
    n = n->next;
  }
  cout << ans << endl;
}
