#include <bits/stdc++.h>
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int dxx[8] = {0, 0, 1, -1, -1, -1, 1, 1};
int dyy[8] = {1, -1, 0, 0, -1, 1, 1, -1};
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int dp[s.size()];
  memset(dp, 1, sizeof(dp));
  if (s[0] == s[1])
    dp[1] = 1;
  else
    dp[1] = 2;
  if (s[2] == s[1])
    dp[2] = 2;
  else
    dp[2] = dp[1] + 1;
  for (long long int i = 3; i < s.size(); i++) {
    if (s[i] == s[i - 1])
      dp[i] = dp[i - 3] + 2;
    else
      dp[i] = dp[i - 1] + 1;
  }
  cout << dp[s.size() - 1] << endl;
  return 0;
}
