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
#include <cstdio>
// Marcin Regdos | Potyczki Algorytmiczne 2018 | Runda 1B POL Język polski
int main(){
  char input[200005];
  bool inputb[200005];
  long long result = 0;
  int n = 0, previd = -1;
  scanf ("%s", input);
  bool alphabet ['z' + 1];
  for (int i = 'a'; i <= static_cast<int>('z'); ++i) alphabet [i] = false;
  alphabet['a'] = alphabet['e'] = alphabet['y'] = alphabet['i'] = alphabet['u'] = alphabet['o'] = true;
  for ( n = 0; input[n]; ++n)
  {
    inputb[n] = alphabet[input[n]];
  }
  
  for (int i = 0; i + 2 < n; ++i)
  {
    if ( (inputb[i] && inputb[i+1] && inputb[i+2])
    || (!inputb[i] && !inputb[i+1] && !inputb[i+2]) )
    {
      result += static_cast<long long>( i - previd ) * static_cast<long long>( n - (i + 2)) ;
      previd = i;    
    }
  }
  printf ("%lld\n", result);
   
  return 0;
}