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
#include <iostream>
#include <string>
using namespace std;

inline bool is_vowel(char c) {
    return (c == 'a') || (c == 'e') || (c == 'i') ||
           (c == 'o') || (c == 'u') || (c == 'y');
}

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

    string input;
    cin >> input;
    int n = input.length();

    unsigned long long ret = 0;
    int first_left = n - 2;

    bool vowel2 = is_vowel(input[n - 1]);
    bool vowel1 = is_vowel(input[n - 2]);
    for (int i = n - 3; i >= 0; --i) {
        bool vowel0 = is_vowel(input[i]);
        if (vowel0 == vowel1 && vowel0 == vowel2) {
            first_left = i;
        }
        ret += n - first_left - 2;

        vowel2 = vowel1;
        vowel1 = vowel0;
    }

    cout << ret;

    return 0;
}