#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define BE(x) x.begin(), x.end()

int main() {
    string s;
    cin >> s;

    ll ans = 0;
    vector<int> v(26, 0);
    int len = s.length();
    v[s[len-1]-'a']++;
    v[s[len-2]-'a']++;
    char prev = '0';
    int x = len;
    for (int i = len-3; i >= 0; i--) {
        if (s[i] == s[i+1] && s[i+1] != s[i+2]) {
            if (s[i] == prev) ans += x - (i+2) - (v[s[i]-'a']-1);
            else ans += len - (i+2) - (v[s[i]-'a']-1);
            for (auto &x : v) x = 0;
            prev = s[i];
            x = i;
        }
        else v[s[i]-'a']++;
    }
    cout << ans << endl;
}
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> prime_number;
    vector<int> used(N+1);
    for (int i=2; i<=N; i++){
        if (used.at(i)==0){
            prime_number.push_back(i);
            int num = 2*i;
            while (num<=N){
                used.at(num)=1;
                num += i;
            }
        }
    }
    vector<int> ans(N+1);
    ans.at(1)=1;
    for (int i=1; i<=N; i++){
        int num = i;
        int index = 0;
        while(index<=(int)prime_number.size()-1&&num<=N){
            num = i*prime_number.at(index);
            if (num<=N) ans.at(num) = ans.at(i)+1;
            index++;

            
        }
    }
    for (int i=1; i<=N; i++){
        cout << ans.at(i) << " ";
    }
    cout << endl;
}