1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<bits/stdc++.h>
using namespace std;

inline bool samogloska(char c){
    return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y' );
}
int32_t main(){
    ios::sync_with_stdio(false);
    string str;
    cin >> str;
    long long n = str.size();
    vector<long long> next(n,n);

    for(int i=n-1;i>=2;i--){
        if(samogloska(str[i]) && samogloska(str[i-1]) && samogloska(str[i-2]))
            next[i-2] = i;
        if(!samogloska(str[i]) && !samogloska(str[i-1]) && !samogloska(str[i-2]))
            next[i-2] = i;
        if(i != n-1)
            next[i-2] = min(next[i-2],next[i-1]);
    }
    long long res = n*(n+1)/2;
    for(int i=0;i<n;i++)
        res -= next[i]-i;
    cout<<res<<"\n";
    return 0;
}