#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << "\n"; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
int n;
string s;
void cleanup() { return; }
void solve() {
  cin >> s;
  n = s.size();
  s += '#';
  int ans = n - n / 3;
  for (int i = 0; i < n - 2; i += 3) {
    if (s[i] != s[i + 1] && s[i + 1] != s[i + 2] && s[i + 2] != s[i + 3]) {
      ans++;
    }
  }
  cout << ans << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
    cleanup();
  }
}
