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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool is_vowel(char c) {
    switch(c) {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'y':
            return true;
        default:
            return false;
    }
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin >> s;

    long long n = s.size();
    long long result = n * (n+1) / 2;

    vector<bool> is_more_difficult(n+1, false);
    vector<bool> is_less_difficult(n+1, false);

    for( int i=0 ; i<n-2 ; i++ ) {
        bool pos_i0 = false, pos_i1 = false, pos_i2 = false;
        pos_i0 =  is_vowel(s[i]);
        pos_i1 = is_vowel(s[i+1]);
        pos_i2 = is_vowel(s[i+2]);
        if( pos_i0 && pos_i1 && pos_i2 ) {
            is_more_difficult[i+2] = true;
            is_less_difficult[i] = true;
        } else if( !(pos_i0 || pos_i1 || pos_i2) ) {
            is_more_difficult[i+2] = true;
            is_less_difficult[i] = true;
        }
    }

    long long i=0, j=0;
    while( i<n && is_more_difficult[i+1]==false ) {
        i++;
    }
    //cout << result << endl;
    result -= (i+1) * (i+2) / 2;
    
    while( i<n-1 ) {
        i++;
        while( i<n-1 && is_more_difficult[i+1]==false ) {
            i++;
        }

        while( j<i ) {
            j++;
            if( is_less_difficult[j-1] ) {
                break;
            }
        }

        //cout << result << endl;
        result -= (i-j+1) * (i-j+2) / 2;
        result++;
    }

    cout << result << endl;


    return 0;
}