#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n;
string s;
int dp[N];
int last[26];
int calc(int k) {
  if (k <= 2) return 1;
  if (k % 3 == 0)
    return 2 * k / 3;
  else
    return 1 + 2 * (k / 3);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(last, -1, sizeof last);
  memset(dp, 0, sizeof dp);
  cin >> s;
  n = s.size();
  dp[0] = 1;
  last[s[0] - 'a'] = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] != s[i]) {
      dp[i] = dp[i - 1] + 1;
    } else {
      int k = -1;
      for (int j = 0; j < 26; j++) {
        if (j != (s[i] - 'a')) k = max(k, last[j]);
      }
      if (k == -1)
        dp[i] = calc(i + 1);
      else
        dp[i] = dp[i - k] + calc(k);
    }
    last[s[i] - 'a'] = i;
  }
  cout << dp[n - 1] << endl;
  return 0;
}
