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
#include <iostream>

using namespace std;

unsigned int min(unsigned int, unsigned int);

bool vowel(const char &c);

int main() {
    ios::sync_with_stdio(false);

    unsigned int v = 0, nv = 0;
    unsigned long long prev = 0;
    unsigned long long result = 0;
    string word;


    cin >> word;

    for (unsigned int i = 0; i < word.length(); i++) {
        if (vowel(word[i])) {
            v = min(v + 1, 3);
            nv = 0;
        } else {
            nv = min(nv + 1, 3);
            v = 0;
        }

        if (v == 3 || nv == 3) {
            prev = i - 1;
        }

        result += prev;
    }

    cout << result << endl;

    return 0;
}

unsigned int min(unsigned int a, unsigned int b) {
    return a < b ? a : b;
}


bool vowel(const char &c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y'; }