//Aleksander Łukasiewicz
#include<bits/stdc++.h>
using namespace std;
#define fru(j,n) for(int j=0; j<(n); ++j)
#define tr(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define ALL(G) (G).begin(),(G).end()
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
const int INF = 1000000009;
int n;
string text;
bool vowel[256];
inline bool Check(int i){
if(i+2 >= n) return false;
int cnt = vowel[text[i]] + vowel[text[i+1]] + vowel[text[i+2]];
return (cnt == 0) || (cnt == 3);
}
int main(){
cin>>text;
n = text.size();
vowel['a'] = true;
vowel['e'] = true;
vowel['i'] = true;
vowel['o'] = true;
vowel['u'] = true;
vowel['y'] = true;
LL res = 0;
int ind = 0;
for(int i=0; i<n; i++){
int j = max(i, ind);
for(; j < n; j++){
if(Check(j)) break;
}
res += max(0, n - (j+2));
ind = j;
}
cout << res << "\n";
return 0;
}
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 46 47 48 49 50 51 52 53 54 55 | //Aleksander Łukasiewicz #include<bits/stdc++.h> using namespace std; #define fru(j,n) for(int j=0; j<(n); ++j) #define tr(it,v) for(typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it) #define x first #define y second #define pb push_back #define mp make_pair #define ALL(G) (G).begin(),(G).end() typedef long long LL; typedef pair<int,int> PII; typedef vector<int> VI; const int INF = 1000000009; int n; string text; bool vowel[256]; inline bool Check(int i){ if(i+2 >= n) return false; int cnt = vowel[text[i]] + vowel[text[i+1]] + vowel[text[i+2]]; return (cnt == 0) || (cnt == 3); } int main(){ cin>>text; n = text.size(); vowel['a'] = true; vowel['e'] = true; vowel['i'] = true; vowel['o'] = true; vowel['u'] = true; vowel['y'] = true; LL res = 0; int ind = 0; for(int i=0; i<n; i++){ int j = max(i, ind); for(; j < n; j++){ if(Check(j)) break; } res += max(0, n - (j+2)); ind = j; } cout << res << "\n"; return 0; } |
English