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
#include <iostream>
using namespace std;

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  string a;
  getline(cin, a);
  int n = a.length(), combo = 0, suma = 0,l,r;
  char znak;
  for(int i = 0;i <= n;i++){
    if(a[i] == 'a' || a[i] == 'e' || a[i] == 'i' || a[i] == 'o' || a[i] == 'u' || a[i] == 'y')
      a[i] = 'a';
    else
      a[i] = 'b';
    if(a[n-1] == 'a')
      a[n] = 'b';
    else
      a[n] = 'a';
    if(i == 0 && i < n)
        znak = a[i];
    if(a[i] == znak)
      combo++;
    else if(combo >= 3 && a[i] != znak){
      suma += (combo*combo - (3*combo) + 2)/2;
      l = i - combo;
      r = n - i;
      suma += l * r;
      suma += (l+r)*(combo-2);
      //cout << i << ' ' << l << ' ' << r << '\n';
      znak = a[i];
      combo = 1;
    }
    else
      combo = 1;
      znak = a[i];
  }
  cout << suma;
}