#include <bits/stdc++.h>
using namespace std;
template <class T>
using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
int main() {
  string s;
  cin >> s;
  vector<int> ct;
  int cnt = 0;
  char c = '?';
  for (int i = 0; i < s.size(); i++) {
    if (c == '?') {
      cnt = 1;
      c = s[i];
      if (s.size() == 1) {
        ct.push_back(1);
      }
    } else if (c != s[i]) {
      ct.push_back(cnt);
      cnt = 1;
      c = s[i];
    } else {
      cnt++;
      if (i == s.size() - 1) {
        ct.push_back(cnt);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < ct.size(); i++) {
    int t = 0;
    while (true) {
      if ((t + 2) * (t + 1) / 2 <= ct[i]) {
        t++;
      } else {
        break;
      }
    }
    ans += t;
  }
  cout << ans + 1 << endl;
  return 0;
}
