#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll << 50;
template <typename T>
void printv(const vector<T>& s) {
  for (int i = 0; i < (int)(s.size()); ++i) {
    cout << s[i];
    if (i == (int)(s.size()) - 1)
      cout << endl;
    else
      cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  int n = (int)(s.size());
  char now = s[0];
  int mi = 1;
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == now) {
      cnt++;
      if (cnt >= mi) {
        ans++;
        mi++;
        cnt = 0;
      }
    } else {
      ans++;
      if (cnt == 0) {
        mi = 2;
        cnt = 0;
        now = s[i];
      } else {
        mi = 1;
        cnt = 0;
        now = s[i];
      }
    }
  }
  cout << ans << endl;
}
