#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  string prev = "";
  while (s != "") {
    string t = s.substr(0, 3);
    s.erase(0, 3);
    if (t.length() == 3) {
      if (t[0] == t[1] || t[1] == t[2])
        cnt += 2;
      else
        cnt += 3;
    } else {
      if (t.length() == 2) {
        if (prev[2] == t[0])
          cnt++;
        else if (t[0] == t[1])
          cnt++;
        else
          cnt += 2;
      } else {
        if (prev[2] != t[0])
          cnt++;
        else if (prev[2] == prev[1] && prev[2] == t[0])
          cnt++;
      }
    }
    prev = t;
  }
  cout << cnt << endl;
  return 0;
}
