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
41
42
#include<bits/stdc++.h>
using namespace std;


long long tab[200003];

int main() {
    string s;

    cin >> s;

    long long n = s.length();

    long long res = 0;

    bool hasFirst = false;

    for(long long i = 0; i < s.length(); i++) {
        if(s[i] == 'a' || s[i] == 'e' || s[i] == 'o' || s[i] == 'u' || s[i] == 'y' || s[i] == 'i')
            tab[i] = 1;
        else tab[i] = 0;
    }

    long long j = -1;

    for(long long i =0  ; i < n - 2 ; i++) {


        if((tab[i] == 0 && tab[i+1] == 0 && tab[i+2] == 0) || (tab[i] == 1 && tab[i+1] == 1 && tab[i+2] == 1)) {
            if(!hasFirst) {
                res += (i+1)* (n - i - 2);
                j = i;
                hasFirst = true;
            } else {
                res +=  (i - j)* (n - i - 2);
                j=i;
            }
        }
    }

    cout << res << endl;
}