#include <bits/stdc++.h>
using namespace std;
const int MX = 2e5 + 1000;
int main() {
  static char s[MX];
  static int f[MX];
  int val = 1;
  for (int i = 1; i < MX; i++) {
    if (i % 3 == 0) {
      val++;
    }
    f[i] = val;
    if (i % 3 == 0) {
      val++;
    }
  }
  ignore = scanf("%s", s);
  size_t n = strlen(s);
  int res = 0;
  char last = 0;
  int cnt = 0;
  for (size_t i = 0; i < n; i++) {
    const char c = s[i];
    if (c == last) {
      cnt++;
    } else {
      res += f[cnt];
      last = c;
      cnt = 1;
    }
  }
  if (cnt != 0) {
    res += f[cnt];
  }
  printf("%d\n", res);
  return 0;
}
