#include <bits/stdc++.h>
using namespace std;
void solve(std::string S) {
  long long ans = 1;
  long long size = S.size();
  long long i;
  char before = S[0];
  for (i = 1; i < size - 2; i += 3) {
    if (before == S[i]) {
      ans += 2;
    } else {
      if (S[i] != S[i + 1] && S[i + 1] != S[i + 2]) {
        ans += 3;
      } else {
        ans += 2;
      }
    }
    before = S[i + 2];
  }
  if (i == size - 1) {
    if (before != S[size - 1]) {
      ans += 1;
    }
  } else if (i == size - 2) {
    if (before == S[size - 2]) {
      ans += 1;
    } else {
      if (S[size - 2] == S[size - 1]) {
        ans += 1;
      } else {
        ans += 2;
      }
    }
  }
  printf("%lld\n", ans);
}
int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}
