#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
std::ostream& operator << (std::ostream& dest, __int128_t value) {
    std::ostream::sentry s(dest);
    if (s) {
        __uint128_t tmp = value<0?-value:value;
        char buffer[128];
        char* d = std::end(buffer);
        do {
            -- d;
            *d = "0123456789"[tmp%10];
            tmp/=10;
        }while(tmp!=0);
        if(value<0) {
            --d;
            *d = '-';
        }
        int len = std::end(buffer)-d;
        if (dest.rdbuf()->sputn(d,len)!=len) {
            dest.setstate(std::ios_base::badbit);
        }
    }
    return dest;
}
void solve() {
    ll i,j,k,l,m,n,o,p,q,r,t;
    string s;
    cin>>s;
    l=s.length();
    ll ops=0;
    ll f[26]={0};
    f[s[l-1]-'a']++;
    for(i=l-2;i>=0;i--) {
        f[s[i]-'a']++;
        if(s[i]==s[i+1]) {
            ops+=(l-i)-f[s[i]-'a'];
            for(j=0;j<26;j++) {
                f[j]=0;
            }
            f[s[i]-'a']=l-i;
        }
    }
    cout<<ops<<endl;
}
int main() {
    ll t=1;
    while(t--) {
       solve();
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin>>s;
    cout<<s[1]<<s[2]<<s[0]<<endl;
     return 0;
}