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