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

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 = 0LL;
    char text[200001];
    scanf("%s\n", text);

    int numFromLastGroup = 0;
    int maxIndexToCheck = ((int) strlen(text)) - 2;
    for (int i = 0; i < maxIndexToCheck; i++) {
	if ((isVowel(text[i]) == isVowel(text[i+1])) && (isVowel(text[i]) == isVowel(text[i+2]))) {
	    result += (numFromLastGroup + 1) * (maxIndexToCheck - i);
	    numFromLastGroup = 0;
	} else {
	    numFromLastGroup++;
	}
    }

    printf("%lld\n", result);

    return 0;
}