#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, pair<T1, T2> P) {
  return s << '<' << P.first << ", " << P.second << '>';
}
template <class T>
ostream& operator<<(ostream& s, vector<T> P) {
  for (long long i = 0; i < P.size(); ++i) {
    if (i > 0) {
      s << " ";
    }
    s << P[i];
  }
  return s;
}
template <class T>
ostream& operator<<(ostream& s, vector<vector<T> > P) {
  for (long long i = 0; i < P.size(); ++i) {
    s << endl << P[i];
  }
  return s << endl;
}
template <class T>
ostream& operator<<(ostream& s, set<T> P) {
  for (__typeof__((P).begin()) it = (P).begin(); it != (P).end(); ++it) {
    s << "<" << *it << "> ";
  }
  return s << endl;
}
template <class T1, class T2>
ostream& operator<<(ostream& s, map<T1, T2> P) {
  for (__typeof__((P).begin()) it = (P).begin(); it != (P).end(); ++it) {
    s << "<" << it->first << "->" << it->second << "> ";
  }
  return s << endl;
}
template <class T>
void show(vector<T> v) {
  for (long long i = 0; i < v.size(); i++) {
    cerr << v[i] << " ";
  }
  cerr << "\n";
}
signed main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long cnt = 0;
  bool flag = false;
  for (long long i = 0; i < n; i += 3) {
    if (i + 2 < n) {
      if (s[i] == s[i + 1] && s[i + 1] == s[i + 2])
        cnt += 2;
      else if (s[i] == s[i + 1] && s[i + 1] != s[i + 2])
        cnt += 2;
      else if (s[i] != s[i + 1] && s[i + 1] == s[i + 2])
        cnt += 2;
      else if (s[i] != s[i + 1] && s[i + 1] != s[i + 2])
        cnt += 3;
    } else if (i == n - 1)
      cnt++;
    else if (i == n - 2) {
      if (s[i] == s[i + 1])
        cnt++;
      else if (s[i] != s[i + 1])
        cnt += 2;
    }
  }
  cout << cnt << endl;
  return 0;
}
