#include <bits/stdc++.h>
using namespace std;
int chk(vector<string> S) {
  int n = S.size() - 1;
  for (int i = 0; i < n; i++) {
    if (S[i] == S[i + 1]) {
      S[i] += S[i + 1];
      S.erase(S.begin() + (i + 1));
      return chk(S);
    }
  }
  return n + 1;
}
int main() {
  string s;
  cin >> s;
  int n = s.size();
  vector<string> S;
  for (int i = 0; i < n; i++) {
    S.push_back(string(1, s[i]));
  }
  cout << chk(S);
}
