#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  if (s.length() == 1) {
    cout << "1";
    return 0;
  }
  if (s.length() == 2) {
    if (s[0] == s[1])
      cout << "1";
    else
      cout << "2";
    return 0;
  }
  int l = s.length() % 3;
  for (int i = 0; i < s.length() - l; i += 3) {
    if (s[i] != s[i + 1] && s[i + 1] != s[i + 2])
      cnt += 3;
    else
      cnt += 2;
  }
  int n = s.length();
  if (l == 1)
    cnt++;
  else {
    if (s[n - 1] != s[n - 2])
      cnt += 2;
    else
      cnt++;
  }
  cout << cnt;
}
