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
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

ll choose_at_least_3(ll n) {
    return n * (n + 1) / 2 - 2 * n + 1;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string s;
    cin >> s;

    if (s.size() <= 2) {
        cout << "0\n";
        return 0;
    }

    bool vowel[26] = {};

    for (char c: string{"aeiouy"}) {
        vowel[c - 'a'] = true;
    }

    bool cur = vowel[s[0] - 'a'];
    int streak = 1;
    ll cur_len = 1;
    ll count = choose_at_least_3(s.size());

    for (int i = 1; i < s.size(); ++i) {
        if (cur == vowel[s[i] - 'a']) {
            if (streak == 2) {
                if (cur_len > 2) {
                    count -= choose_at_least_3(cur_len);
                }
                cur_len = 1;
            } else {
                ++streak;
            }
        } else {
            cur = vowel[s[i] - 'a'];
            streak = 1;
        }
        ++cur_len;
    }

    if (cur_len > 2) {
        count -= choose_at_least_3(cur_len);
    }

    cout << count << endl;

    return 0;
}