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
#include <string>
#include <iostream>
#include <vector>
#include <set>
#define MAX 1000009

using namespace std;

set<char> vowels = {'a', 'e', 'i', 'o', 'u', 'y'};

bool isThreeCons(string &input, int i) {
    for (int j=0; j<3; j++) {
        if (vowels.count(input[i+j])) return false;
    }
    return true;
}

bool isThreeVow(string &input, int i) {
    for (int j=0; j<3; j++) {
        if (!vowels.count(input[i+j])) return false;
    }
    return true;
}

int main() {
    long long result = 0;

    vector<int> intervals;
    string s;
    cin >> s;
    int len = s.length(), counter = 0;

    for (int i=0; i<len-2; i++) {
        if (isThreeCons(s, i) || isThreeVow(s, i)) {
            intervals.push_back(counter);
            counter = 0;
        } else {
counter++;
        }
    }

    intervals.push_back(counter);

    long long sum = 0;
    for (int i=0; i<intervals.size()-1; i++) {
        sum += intervals[i] + 1;
        result += (sum) * (intervals[i+1] + 1);
    }

    cout << result;
}