#include <bits/stdc++.h>
using namespace std;
ifstream f("1.in");
long long len;
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) len += i;
  for (int i = 0; i < s.size(); i++) {
    for (int j = i - 1; j >= 0; j--) {
      int gasit = 0;
      for (int x = 0; x <= 10 && gasit == 0; x++)
        for (int k = 1; k <= 10; k++) {
          if (j + x + 2 * k > i) break;
          if (s[j + x] == s[j + x + k] && s[j + x + k] == s[j + x + 2 * k])
            gasit++;
        }
      if (gasit) break;
      len--;
    }
  }
  cout << len;
  return 0;
}
