#include <bits/stdc++.h>
using namespace std;
int n;
char s[200000 + 5];
int cnt, sum, p, F, ans;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  cnt = 1, p = 1, F = 1;
  for (int i = 2; i <= n; i++)
    if (s[i] == s[i - 1]) {
      cnt++;
      if ((p + 2) * (p + 1) / 2 == cnt)
        p++, F = 1;
      else
        F = 0;
    } else {
      ans += p + (F == 0);
      if (F)
        cnt = 1, p = 1, F = 1;
      else
        cnt = 0, p = 0, F = 1;
    }
  ans += p;
  printf("%d", ans);
}
