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
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <bits/stdc++.h>

using namespace std;

bool isa(char x) {
    return x =='a' or x=='e' or x=='i' or x=='o' or x=='u' or x=='y';
}

constexpr int N = 3;

int main() {
    string napis;
    cin >> napis;
    
    vector<int> ntru(napis.size());
    
    int ca = 0, cb = 0;
    int ntr = napis.size();
    for (int j=napis.size()-1; j>=0; --j) {
        if (isa(napis[j])) {
            ++ca;
            cb = 0;
        } else {
            ++cb;
            ca = 0;
        }
        
        if (ca >=N or cb >= N)
            ntr = j;
        
        ntru[j] = ntr;
    }
    
    long long ans = 0;
    for (int i = 0; i < napis.size(); ++i) {
        int first_valid_end = min<int>(napis.size() + 1, ntru[i] + N);
        ans += napis.size() - first_valid_end + 1;
    }
    cout << ans << endl;
}