#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  while (true) {
    string tmp;
    bool done = true;
    for (size_t i = 0; i < s.size(); ++i) {
      if (i < s.size() - 1 && s[i] != s[i + 1]) {
        done = false;
        i += 1;
        count += 1;
      } else {
        tmp.push_back(s[i]);
      }
    }
    s = tmp;
    if (done) {
      break;
    }
  }
  cout << count * 2 << endl;
}
