#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
const int MAX = 3e5 + 10;
char S[MAX];
const int BO = 20;
int P[MAX];
int T[MAX];
int main() {
  scanf("%s", S);
  ll res = 0;
  int n = strlen(S);
  for (int len = 3; len <= n; len++) {
    if (len >= BO) {
      res += (n - len + 1);
    } else {
      for (int i = 0; i + len - 1 < n; i++) {
        T[i] = max(P[i], P[i + 1]);
        if (T[i] == 1)
          res++;
        else {
          if (len % 2 == 0) continue;
          if (S[i] == S[i + len / 2] && S[i + len / 2] == S[i + len - 1]) {
            T[i] = 1;
            res++;
          }
        }
      }
      for (int i = 0; i < n; i++) {
        P[i] = T[i];
        T[i] = 0;
      }
    }
  }
  printf("%lld\n", res);
}
