#include <bits/stdc++.h>
// #define cerr if(0)cout
using namespace std;
typedef long long ll;
const int duzo = 200007;
char s[duzo];
bool czysam(char c) {
return c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='y';
}
int main() {
ios_base::sync_with_stdio(0);
//cin.tie(0);
cin >> &s[1];
ll dl = strlen(&s[1]);
ll wyn = 0;
int sm = 0, sp = 0, ost = 0;
for(int i = 1; i <= dl; ++i) {
if(czysam(s[i])) {
++sm;
sp = 0;
}
else {
++sp;
sm = 0;
}
int gz = max(sm, sp);
if(gz >= 3) ost = i - 2;
wyn += ost;
}
cout << wyn;
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 | #include <bits/stdc++.h> // #define cerr if(0)cout using namespace std; typedef long long ll; const int duzo = 200007; char s[duzo]; bool czysam(char c) { return c=='a' || c=='e' || c=='i' || c=='o' || c=='u' || c=='y'; } int main() { ios_base::sync_with_stdio(0); //cin.tie(0); cin >> &s[1]; ll dl = strlen(&s[1]); ll wyn = 0; int sm = 0, sp = 0, ost = 0; for(int i = 1; i <= dl; ++i) { if(czysam(s[i])) { ++sm; sp = 0; } else { ++sp; sm = 0; } int gz = max(sm, sp); if(gz >= 3) ost = i - 2; wyn += ost; } cout << wyn; return 0; } |
English