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

using namespace std;

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

int main()
{
    uint64_t total = 0;
    string s;
    bool last = true;
    int last_begin = 0;
    int begin = 0;
    int num = 0;
    cin >> s;
    for (size_t i = 0; i < s.length(); ++i) {
        char c = s[i];
        auto isvowel = isVowel(c);
        if (last_begin == -1 || isvowel != last) {
            last = isvowel;
            num = 1;
            begin = i;
        } else {
            num++;
        }

        if (num >= 3) {
            int left = last_begin + 1;
            uint64_t places_left = begin - last_begin + 1;
            uint64_t places_right = s.length() - i;
            auto places = places_left * places_right;
            // cout << i << " " << begin << " " << last_begin << " " << places_left << " " << places_right << " -> " << places << endl;
            total += places;

            begin++;
            last_begin = begin;
        }
    }
    cout << total << endl;
    return 0;
}