#include <bits/stdc++.h>
using namespace std;
char s[4004000];
int main() {
  scanf("%s", s);
  long long n = strlen(s);
  long long res = n * (n - 1) / 2;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      bool ok = 1;
      for (int k = i; k < j; k++) {
        if (s[j] == s[k]) {
          int in = 2 * k - j;
          if (in >= i && in <= j && s[in] == s[j]) {
            ok = 0;
            break;
          }
        }
      }
      if (!ok) break;
      res--;
    }
  }
  cout << res << endl;
  return 0;
}
