#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<char> tower;
  for (auto x : s) {
    tower.push_back(x);
  }
  int ans = 0;
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < tower.size(); i++) {
      if (tower.size() <= 1) {
        break;
      }
      if (tower[i] != tower[i + 1]) {
        tower.erase(tower.begin() + i);
        tower.erase(tower.begin() + i);
        ans += 2;
        i--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
