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
#include <bits/stdc++.h>
using namespace std;
int tab[200005];
int main()
{
	string s;
	cin>>s;
	int n=s.size()-1;
	long long w=0;
	int k=0;
	for(int i=0;i<=n;i++){
		if(s[i]=='a' || s[i]=='e' || s[i]=='i' || s[i]=='o' || s[i]=='u' || s[i]=='y'){
			tab[i]=1;
		}
		else{
			tab[i]=-1;
		}
	}
	int c=0;
	for(int i=0;i<=n;i++){
		if(tab[i]==1){
			if(c<0){
				c=0;
			}
			c++;
		}
		if(tab[i]==-1){
			if(c>0){
				c=0;
			}
			c--;
		}
		if(c==3){
			w+=((i-1-k)*(n-i+1));
			c--;
			k=i-1;
		}
		if(c==-3){
			w+=((i-1-k)*(n-i+1));
			c++;
			k=i-1;
		}
	}
	cout<<w;
}