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

using namespace std;

using LL = long long int;

const int MAX_N = 200007;

set<char> vowels = {'a', 'e', 'i', 'o', 'u', 'y'};
int input[MAX_N];

int main() {
  string word;
  cin >> word;
  LL n = word.length();
  int counter = 0;
  for (int i = 0; i < word.length(); ++i) {
    char letter = word[i];
    if (vowels.find(letter) != vowels.end()){
      input[counter++] = 1;
    } else {
      input[counter++] = 2;
    }
  }
  LL beg = 0, result = 0;
  for (long long int i = 2; i < n; ++i) {
    if (input[i] == input[i - 1] && input[i] == input[i - 2]) {
      result += ((i - beg) * (i - beg + 1LL)) / 2LL;
      --result;
      beg = i - 1;
    }
  } 
  result += ((n - beg) * (n - beg + 1LL)) / 2LL;
  printf("%lld\n", ((n * (n + 1LL)) / 2LL) - result);
  return 0;
}