#include<cstdio>
#include <iostream>
#include<string>
using namespace std;
#define REP(x, n) for(int x = 0; x < n; x++)
#define PB push_back
#define LL long long
#define MAX 200003;
#define FORD(x,b,e) for(int x = b; x >= e; x--)
bool is_zero(char a){
return a == 'a' || a == 'e' || a =='o' || a == 'u' || a == 'y' || a == 'i';
}
int main() {
LL wynik = 0;
string word;
// std::getline(std::cin, word);
cin>>word;
// scanf("%s", &word);
// cout<<word<<endl;
int ln = word.length();
// cout<<ln<<endl;
int start = 0;
for(int x = 2; x < ln; x++){
if (is_zero(word[x-2]) == is_zero(word[x-1]) && is_zero(word[x-1])== is_zero(word[x])){
// cout<<word[x-2]<<word[x]<<word[x]<<endl;
wynik += (x-start-1) * (ln - x);
// cout<<x<< " "<<x-start-1<<" "<<ln-x<< " "<< wynik <<" " << x - 1<<endl;
start = x - 1;
}
}
cout<<wynik<<endl;
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 | #include<cstdio> #include <iostream> #include<string> using namespace std; #define REP(x, n) for(int x = 0; x < n; x++) #define PB push_back #define LL long long #define MAX 200003; #define FORD(x,b,e) for(int x = b; x >= e; x--) bool is_zero(char a){ return a == 'a' || a == 'e' || a =='o' || a == 'u' || a == 'y' || a == 'i'; } int main() { LL wynik = 0; string word; // std::getline(std::cin, word); cin>>word; // scanf("%s", &word); // cout<<word<<endl; int ln = word.length(); // cout<<ln<<endl; int start = 0; for(int x = 2; x < ln; x++){ if (is_zero(word[x-2]) == is_zero(word[x-1]) && is_zero(word[x-1])== is_zero(word[x])){ // cout<<word[x-2]<<word[x]<<word[x]<<endl; wynik += (x-start-1) * (ln - x); // cout<<x<< " "<<x-start-1<<" "<<ln-x<< " "<< wynik <<" " << x - 1<<endl; start = x - 1; } } cout<<wynik<<endl; return 0; } |
English