#include <bits/stdc++.h>
using namespace std;
int n;
char s[300005];
long long ans;
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int l = 0; l < n; l++) {
    int r = l;
    while (1) {
      bool check = 1;
      for (int i = l + 1; i < r; i++) {
        int d = r - i;
        if (i - d >= l && s[r] == s[i] && s[i] == s[i - d]) {
          check = 0;
          break;
        }
      }
      if (!check) break;
      r++;
    }
    if (r < n) ans += (long long)(n - r);
  }
  cout << ans << endl;
  return 0;
}
