#include <bits/stdc++.h>
using namespace std;
int main() {
  stack<int> s1;
  stack<int> s2;
  string s;
  long long sum1, sum2;
  cin >> s;
  for (long long i = 0; i < s.length(); i++) {
    s1.push(s[i] - '0');
  }
  sum1 = s1.size();
  while (s1.empty() != true) {
    int cpy = s1.top();
    s1.pop();
    int cpy1 = s1.top();
    s1.pop();
    if (cpy != cpy1) {
      s2.push(cpy);
      s2.push(cpy1);
    } else {
      while (s2.empty() != true) {
        s1.push(s2.top());
        s2.pop();
      }
    }
  }
  sum2 = s2.size();
  cout << sum1 - sum2;
  return 0;
}
