#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0, pos = 0;
  bool flg = false;
  while (pos < s.size()) {
    char lbuf = s.at(pos), rbuf = s.at(min(pos + 1, (int)(s.size() - 1)));
    if (lbuf != rbuf) {
      ans += 2;
      if (pos == 0)
        pos++;
      else
        s.at(min(pos + 1, (int)(s.size() - 1))) = s.at(pos - 1);
    }
    pos++;
  }
  cout << ans << endl;
  return 0;
}
