#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  const int MAGIC = 50;
  auto check = [&](int l, int r) {
    for (int i = l; i <= r; i++) {
      for (int j = 1; j < MAGIC && i + 2 * j <= r; j++) {
        if (s[i] == s[i + j] && s[i] == s[i + 2 * j]) {
          return false;
        }
      }
    }
    return true;
  };
  long long res = (long long)n * (n - 1) / 2;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (j - i > MAGIC) break;
      if (check(i, j)) res--;
    }
  }
  cout << res << '\n';
  return 0;
}
