#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f3f;
const int maxn = 1e5 + 500;
long long T, n, m;
int main() {
  string s;
  cin >> s;
  int cnt = 0;
  for (int i = 0, j; i < s.length(); i++) {
    int sum = 1;
    for (j = 1; (i + j) < s.length(); j++) {
      if (s[i + j] == s[i]) {
        sum++;
      } else {
        i = (i + j - 1);
        break;
      }
    }
    if (sum > 2)
      cnt += 2;
    else
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}
