#include <iostream> #include <cstdio> using namespace std; const int S = 300, N = 2e5+5; bool lit[S]; char s[N]; long long ans; int n, ost = -1; int main() { lit['a'] = 1; lit['e'] = 1; lit['y'] = 1; lit['u'] = 1; lit['i'] = 1; lit['o'] = 1; scanf("%s", s); while(s[n]) n++; for(int i = 2 ; i < n ; i++) { if(lit[s[i]] == lit[s[i - 1]] && lit[s[i]] == lit[s[i - 2]]) { long long p = i - ost - 2; long long k = n - i; ans += p * k; ost = i - 2; } } printf("%lld", ans); 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 | #include <iostream> #include <cstdio> using namespace std; const int S = 300, N = 2e5+5; bool lit[S]; char s[N]; long long ans; int n, ost = -1; int main() { lit['a'] = 1; lit['e'] = 1; lit['y'] = 1; lit['u'] = 1; lit['i'] = 1; lit['o'] = 1; scanf("%s", s); while(s[n]) n++; for(int i = 2 ; i < n ; i++) { if(lit[s[i]] == lit[s[i - 1]] && lit[s[i]] == lit[s[i - 2]]) { long long p = i - ost - 2; long long k = n - i; ans += p * k; ost = i - 2; } } printf("%lld", ans); return 0; } |