#include <cstdio> #include <cstring> int getType(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c=='u' || c=='y') { return 1; } else { return 0; } } char input[200100]; int main() { int len; int first = -1; long long int result = 0; scanf("%s",input); len = strlen(input); for (int pos=0; pos<len; ++pos) { if (first<pos) { while (1) { ++first; if (first+2>=len) { printf("%lld\n",result); return 0; } if (getType(input[first])==getType(input[first+1]) && getType(input[first])==getType(input[first+2])) { break; } } } result += (long long int)len-first-2; } }
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 | #include <cstdio> #include <cstring> int getType(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c=='u' || c=='y') { return 1; } else { return 0; } } char input[200100]; int main() { int len; int first = -1; long long int result = 0; scanf("%s",input); len = strlen(input); for (int pos=0; pos<len; ++pos) { if (first<pos) { while (1) { ++first; if (first+2>=len) { printf("%lld\n",result); return 0; } if (getType(input[first])==getType(input[first+1]) && getType(input[first])==getType(input[first+2])) { break; } } } result += (long long int)len-first-2; } } |