#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int INF = int(2e9);
const long long LINF = long long(2e9) * long long(2e9);
template <class T, class C>
void chmax(T& a, C b) {
  a > b ?: a = b;
}
template <class T, class C>
void chmin(T& a, C b) {
  a < b ?: a = b;
}
int calc(vector<string>& Strs) {
  int ans = 0;
  for (int i = 0; i < Strs.size(); i++) {
    if (Strs[i].size() == 1) {
      ans++;
    }
  }
  for (int i = 0; i < Strs.size(); i++) {
    if (Strs[i].size() == 1) continue;
    if (i > 0 && i < Strs.size() - 1) {
      if (Strs[i - 1][0] != Strs[i][0] && Strs[i + 1][0] != Strs[i][1] &&
          Strs[i][0] != Strs[i][1])
        ans += 2;
      else
        ans++;
    } else if (i > 0) {
      if (Strs[i - 1][0] != Strs[i][0] && Strs[i][0] != Strs[i][1])
        ans += 2;
      else
        ans++;
    } else if (i < Strs.size() - 1) {
      if (Strs[i + 1][0] != Strs[i][1] && Strs[i][0] != Strs[i][1])
        ans += 2;
      else
        ans++;
    } else {
      if (Strs[i][0] != Strs[i][1])
        ans += 2;
      else
        ans++;
    }
  }
  return ans;
}
int main() {
  string S;
  cin >> S;
  vector<string> Strs1, Strs2;
  int pos = 0;
  int num = 1;
  while (1) {
    if (pos >= S.size()) break;
    Strs1.push_back(S.substr(pos, num));
    if (pos + num >= S.size()) break;
    Strs1.push_back(S.substr(pos + num, num % 2 + 1));
    pos += 3;
  }
  pos = 0;
  num = 2;
  while (1) {
    if (pos >= S.size()) break;
    Strs2.push_back(S.substr(pos, num));
    if (pos + num >= S.size()) break;
    Strs2.push_back(S.substr(pos + num, num % 2 + 1));
    pos += 3;
  }
  cout << max(calc(Strs1), calc(Strs2)) << endl;
  return 0;
}
