#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
char s[N];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int ans = n / 3 * 2 + (n % 3 != 0);
  for (int i = 0; i < n; i++)
    if (i % 3 == 1)
      if (s[i] != s[i + 1] && s[i] != s[i - 1] && s[i + 1] != s[i + 2]) ans++;
  printf("%d\n", ans);
  return 0;
}
