#include <bits/stdc++.h>
using namespace std;
string S;
int main() {
  cin >> S;
  int n = S.size();
  int ans = 0;
  int prev = S[0];
  if (S[0] != S[1]) {
    ans += 2;
  }
  for (int i = 2; i < n - 2; i++) {
    if (S[i] != S[i - 1]) {
      ans += 2;
    }
    S[i] = prev;
  }
  cout << ans << endl;
  return 0;
}
