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
#include <cstdio>

using namespace std;

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

int main() {
    long long result = 0;
    bool last_v = isvowel(getchar());
    long long diff = 0;
    long dspan = 0;
    long span = 1;
    for (char c = getchar(); c != '\n' && c != EOF; c = getchar()) {
        bool v = isvowel(c);
        if (last_v == v)
            span++;
        else
            span = 1;
        if (span >= 3) {
            diff += dspan;
            dspan = 1;
        } else {
            dspan++;
        }
        result += diff;
        last_v = v;
    }
    printf("%lld\n", result);
}