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

using namespace std;

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

int main() {
    string s;
    int c1 = 1;
    long c2 = 0;
    bool wasVowel;
    long len;
    long counter = 0;
    cin >> s;
    len = s.length();
    wasVowel = isVowel(s[0]);
    for (int i=1; i<len; i++) {
        if (wasVowel == isVowel(s[i])) {
			if (c1 == 2) {
				counter += (c2 + 1) * (len - i);
				c2 = 0;
			} else {
				c1++;
			}
        } else {
        	c2 += c1;
        	c1 = 1;
        	wasVowel = isVowel(s[i]);
		}
    }
    cout << counter << endl;
}