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

char mapCharToInt(char x) {
    if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u' || x == 'y') {
        return 0;
    }
    return 1;
}

int main() {
    unsigned long long int result = 0;
    std::vector<char> letters;
    std::string originalLetters;
    std::getline (std::cin, originalLetters);
    for(auto letter : originalLetters) {
        letters.push_back(mapCharToInt(letter));
    }
    if (letters.size() < 3) {
        printf("%d", 0);
        return 0;
    }
    int currentIndex = 0;
    int indexesFound = 0;
    int lastIndexFound = 0;
    int lastViableIndex = letters.size() - 3;
    while (currentIndex <= lastViableIndex) {
        if (letters.at(currentIndex) == letters.at(currentIndex + 1) &&
            letters.at(currentIndex) == letters.at(currentIndex + 2)) {
            result = result + (currentIndex + 1 - lastIndexFound) * (lastViableIndex - currentIndex + 1);
            lastIndexFound = currentIndex + 1;
            indexesFound++;
        }
        currentIndex++;
    }
    printf("%llu\n", result);
    return 0;
}