#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int>> cn(long long int n, long long int m) {
  return vector<vector<long long int>>(n, vector<long long int>(m));
}
bool compare(char &s1, char &s2) { return s1 > s2; }
bool sortmahstyle(const pair<long long int, long long int> &a,
                  const pair<long long int, long long int> &b) {
  if (a.first < b.first) return true;
  if (a.first == b.first && a.second != b.second) return true;
  return false;
}
bool cmp(int n, pair<int, int> const &p) { return (p.first < n); }
long long int const mod = 1e9 + 7;
long long int const inf = 1e18;
long long int const maxn = 2e5 + 1;
int stoint(string s) {
  int n = s.size();
  int num = 0;
  for (long long int i = 0; i < n; i++) {
    num = num * 10 + (int)(s[i] - '0');
  }
  return num;
}
string s;
long long int memo[maxn][3];
long long int dp(long long int n, string prev = "") {
  long long int z = prev.size();
  if (n == 0) return 0;
  if (memo[n][z] != -1) return memo[n][z];
  string hm = "";
  hm += s[n - 1];
  if (hm != prev)
    return memo[n][z] = max((n - 1 > 0 ? 1 + dp(n - 1, hm) : 0),
                            (n - 2 > 0 ? 1 + dp(n - 2, hm + s[n - 2]) : 0ll));
  else
    return memo[n][z] = (n - 2 > 0 ? 1 + dp(n - 2, hm + s[n - 2]) : 0);
}
void solve() {
  fill(memo[0], memo[0] + maxn, -1);
  fill(memo[1], memo[1] + maxn, -1);
  fill(memo[2], memo[2] + maxn, -1);
  cin >> s;
  cout << dp(s.size()) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  for (long long int testcases = 0; testcases < t; testcases++) {
    solve();
  }
  return 0;
}
