#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (auto _ : v) os << _ << ", ";
  os << "]" << endl;
  return os;
};
template <typename T>
ostream &operator<<(ostream &os, set<T> &st) {
  os << "(";
  for (auto _ : st) {
    os << _ << ", ";
  }
  os << ")";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "{" << p.first << ", " << p.second << "}";
  return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp) {
  os << "[";
  for (auto _ : mp) {
    os << _ << ", ";
  }
  os << "]" << endl;
  return os;
}
void dump_func() { cerr << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&...tail) {
  cerr << head;
  if (sizeof...(Tail) > 0) {
    cerr << ", ";
  }
  dump_func(std::move(tail)...);
}
const int INF = (long long)1e9;
const long long INFLL = (long long)1e18 + 1;
const long long MOD = 1000000007;
const long double PI = acos(-1.0);
long long dp[200010][3];
int main() {
  string S;
  cin >> S;
  int N = S.size();
  for (int i = 0; i < int(N + 1); ++i)
    for (int j = 0; j < int(3); ++j) dp[i][j] = 0;
  for (int i = 0; i < int(N); ++i) {
    if (i == 0) {
      for (int k = 1; k < int(2); ++k) chmax(dp[i + k][k], dp[i][0] + 1);
      continue;
    }
    for (int j = 1; j < int(3); ++j)
      for (int k = 1; k < int(3); ++k) {
        if (i - j < 0) continue;
        if (i + k > N) continue;
        string pre = S.substr(i - j, j);
        string nxt = S.substr(i, k);
        if (pre == nxt) continue;
        chmax(dp[i + k][k], dp[i][j] + 1);
      }
  }
  cout << max(dp[N][1], dp[N][2]) << endl;
}
