#include <bits/stdc++.h>
using namespace std;
string redbul;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> redbul;
  stack<char> rb;
  long long count = 0;
  char before_rb = redbul[0];
  rb.push(redbul[0]);
  for (int i = 1; i < redbul.length(); i++) {
    if (before_rb != redbul[i]) {
      count++;
      rb.pop();
    } else {
      rb.push(redbul[i]);
    }
    before_rb = redbul[i];
  }
  cout << count * 2 << endl;
  return 0;
}
