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

using namespace std;

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

bool is_consonant(char c) {
    return !is_vowel(c);
}

bool all_same(char a, char b, char c) {
    return (is_vowel(a) && is_vowel(b) && is_vowel(c)) ||
        (is_consonant(a) && is_consonant(b) && is_consonant(c));
}

const int MAX_N = 200001;

int main() {
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int closest_triplet = -1;
    long long total = 0;
    for (int i = 2; i < s.size(); i++) {
        if (all_same(s[i], s[i-1], s[i-2])) {
            closest_triplet = i-2;
        }
        total += closest_triplet + 1;
    }
    cout << total << '\n';
}