///In the name of GOD
//#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MXN = 3e5 + 10;
const ll SGM = 30;
ll n, ans;
string s;
ll Cnt[SGM];
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> s; n = s.size();
    s = "$" + s;
    Cnt[s[n] - 'a'] ++;
    Cnt[s[n - 1] - 'a'] ++;
    for(int i = n - 2; i; i --){
        if(s[i] == s[i + 1]){
            ans += (n - (i + 1)) - (Cnt[s[i] - 'a'] - 1);
            memset(Cnt, 0, sizeof Cnt);
            Cnt[s[i] - 'a'] = n - (i - 1);
        }
        else{
            Cnt[s[i] - 'a'] ++;
        }
    }
    cout << ans << '\n';
    return 0;
}
/*!
    HE'S AN INSTIGATOR,
    ENEMY ELIMINATOR,
    AND WHEN HE KNOCKS YOU BETTER
    YOU BETTER LET HIM IN.
*/
//! N.N

#include "bits/stdc++.h"

using namespace std;
#define int long long
const int MAX=1e5+10;
const int mod=1e9+7;
const int INF=0x3f3f3f3f3f3f3f3f;

void solve(){
    string tem="ZONe";
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<s.size();i++){
        int ji=0;
        for(int j=0;j<tem.size();j++){
            if(s[i+j]==tem[j]){
                ji++;
            }
        }
        if(ji==tem.size()){
            ans++;
        }
    }
    cout<<ans;

}
signed main(){
    int _=1;
    //ios::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    //cin>>_;
    for(int i=1;i<=_;i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}