#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); string we; int ciag = 0; unsigned long long ost3 = 0; unsigned long long wynik = 0; cin >> we; for(int i = 0; i < (int)we.length(); ++i) { if((we[i] == 'a') || (we[i] == 'e') || (we[i] == 'i') || (we[i] == 'o') || (we[i] == 'u') || (we[i] == 'y')) { if(ciag >= 0) ciag = -1; else --ciag; } else { if(ciag <= 0) ciag = 1; else ++ciag; } if(abs(ciag) > 2) ost3 = i - 1; wynik += ost3; } cout << wynik; 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 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); string we; int ciag = 0; unsigned long long ost3 = 0; unsigned long long wynik = 0; cin >> we; for(int i = 0; i < (int)we.length(); ++i) { if((we[i] == 'a') || (we[i] == 'e') || (we[i] == 'i') || (we[i] == 'o') || (we[i] == 'u') || (we[i] == 'y')) { if(ciag >= 0) ciag = -1; else --ciag; } else { if(ciag <= 0) ciag = 1; else ++ciag; } if(abs(ciag) > 2) ost3 = i - 1; wynik += ost3; } cout << wynik; return 0; } |