#include <cstdio>
#include <cstring>
int main() {
char word[200001];
scanf("%s", word);
long long sum = 0;
int last_streak = -1;
int vowels = 0, consonants = 0;
for(int i = 0; i < strlen(word); ++i) {
char x = word[i];
if(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u' || x == 'y') {
vowels += 1;
consonants = 0;
} else {
consonants += 1;
vowels = 0;
}
if(consonants + vowels >= 3)
last_streak = i - 1;
if(last_streak >= 0)
sum += last_streak;
}
printf("%lld\n", sum);
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 | #include <cstdio> #include <cstring> int main() { char word[200001]; scanf("%s", word); long long sum = 0; int last_streak = -1; int vowels = 0, consonants = 0; for(int i = 0; i < strlen(word); ++i) { char x = word[i]; if(x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u' || x == 'y') { vowels += 1; consonants = 0; } else { consonants += 1; vowels = 0; } if(consonants + vowels >= 3) last_streak = i - 1; if(last_streak >= 0) sum += last_streak; } printf("%lld\n", sum); return 0; } |
English