#include <iostream> #include <string> using namespace std; long long z1, z2, k, wyn, n, x1, x2; string slo; int main() { ios_base::sync_with_stdio(0); cin >> slo; n = slo.size(); k = 0; if (slo[0] == 'a' || slo[0] == 'e' || slo[0] == 'i' || slo[0] == 'o' || slo[0] == 'u' || slo[0] == 'y')x1 = 1; for (int i = 1; i < n; i++) { z2 = z1; x2 = x1; if (slo[i] == 'a' || slo[i] == 'e' || slo[i] == 'i' || slo[i] == 'o' || slo[i] == 'u' || slo[i] == 'y')x1 = 1; else x1 = 0; if (x1 == x2)z1 = 1; else z1 = 0; if (z1 == 1 && z2 == 1)k = i - 1; wyn += k; } printf("%lld", wyn); // system("PAUSE"); }
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 | #include <iostream> #include <string> using namespace std; long long z1, z2, k, wyn, n, x1, x2; string slo; int main() { ios_base::sync_with_stdio(0); cin >> slo; n = slo.size(); k = 0; if (slo[0] == 'a' || slo[0] == 'e' || slo[0] == 'i' || slo[0] == 'o' || slo[0] == 'u' || slo[0] == 'y')x1 = 1; for (int i = 1; i < n; i++) { z2 = z1; x2 = x1; if (slo[i] == 'a' || slo[i] == 'e' || slo[i] == 'i' || slo[i] == 'o' || slo[i] == 'u' || slo[i] == 'y')x1 = 1; else x1 = 0; if (x1 == x2)z1 = 1; else z1 = 0; if (z1 == 1 && z2 == 1)k = i - 1; wyn += k; } printf("%lld", wyn); // system("PAUSE"); } |