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

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

int main() {
    std::string text;
    std::cin >> text;

    int startIdx = 0;
    long long combinations = 0;
    int n = text.length();
    for (int i = 0; i < n - 2; ++i) {
        bool state = isVowel(text[i]);
        if (isVowel(text[i+1]) == state && isVowel(text[i+2]) == state) {
            int before = i - startIdx;
            int after =  n - i - 3;
            combinations += 1 + before + after + before * after;
            startIdx = i + 1;
        }
    }
    std::cout << combinations;
}