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
43
44
45
46
47
48
#include <iostream>
using namespace std;

int main(){
    string s;
    cin >> s;

    long long int result = 0;
    long long int n = s.length();
    bool isLastVow = false;
    bool isLast2Vow = false;
    bool isLastCons = false;
    bool isLast2Cons = false;

    long long int start = 0;

    for(int i = 0; i < n; i++)
    {
        bool vow = (s[i] == 'e' || s[i] == 'y' || s[i] == 'u' || s[i] == 'i' || s[i] == 'o' || s[i] == 'a');
        if(isLast2Vow && vow || isLast2Cons && !vow)
        {
            result -= (i-start) + (i-start)*(i-start-1)/2 - 1;
            start = i-1;
            continue;
        }
        if(vow){
            isLastCons = false;
            isLast2Cons = false;
            isLast2Vow = isLastVow;
            isLastVow = true;
        } else {
            isLastVow = false;
            isLast2Vow = false;
            isLast2Cons = isLastCons;
            isLastCons = true;
        }
    }

    result -= (n-start) + (n-start)*(n-start-1)/2;

    result += n*(n-1)/2 + n; 
    cout<<result<<endl;

    return 0;
}

//abeeccаggoxxuuhhaalleerruucceettoonnaqaqaqaqaqaqaq
//