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

using namespace std;


unordered_set<char> VOWELS = {'a', 'e', 'i', 'o', 'u', 'y'};


bool isVowel(char c) {
    return VOWELS.find(c) != VOWELS.end();
}

bool checkIfTriple(unsigned long long pos, string& text) {
    assert(pos + 2 < text.size());

    if (isVowel(text[pos]) && isVowel(text[pos + 1]) && isVowel(text[pos + 2])) {
        return true;
    }

    if (!isVowel(text[pos]) && !isVowel(text[pos + 1]) && !isVowel(text[pos + 2])) {
        return true;
    }

    return false;
}

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

    unsigned long long hardFragmentsNum = 0;
    unsigned long long lastTriple = -1; // last found triple was at positions <lastTriple, lastTriple+1, lastTriple+2>

    for (unsigned long long i = 0; i < text.size() - 2; ++i) {
        bool isTriple = checkIfTriple(i, text);
        
        if (!isTriple) {
            continue;
        }

        unsigned long long leftLettersNum = i - lastTriple - 1;
        unsigned long long rightLettersNum = text.size() - (i + 2) - 1;
        hardFragmentsNum += (leftLettersNum + 1) * (rightLettersNum + 1);
        
        lastTriple = i;
    }

    cout << hardFragmentsNum << endl;

    return 0;
}