#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int ans = 0;
  string s;
  cin >> s;
  if (s.length() < 2) {
    cout << 0;
    return 0;
  }
  if (s.length() == 2) {
    cout << 2 * (s[0] == s[1]);
    return 0;
  }
  if (s[0] != s[1]) {
    ans = 2;
    s[1] = s[2];
  }
  for (long long int i = 2; i < s.length(); i++) {
    if (s[i] != s[i - 1]) {
      ans += 2;
      s[i] = s[i - 2];
    }
  }
  cout << ans;
}
