#include <iostream>
#include <string>
using namespace std;
int main() {
string input;
cin >> input;
unsigned int length = input.length();
unsigned long counter = 0;
string i[9389];
string d = "aeiou";
unsigned int e = 0;
// samogłoski
for(int f = 0; f<5; f++)
{
for(int g = 0; g<5; g++)
{
for(int h = 0; h<5; h++)
{
i[e] = {d[f], d[g], d[h]};
e++;
}
}
}
// spółgłoski
string k = "bcdfghjklmnpqrstvwxyz";
for(int f = 0; f<21; f++)
{
for(int g = 0; g<21; g++)
{
for(int h = 0; h<21; h++)
{
i[e] = {k[f], k[g], k[h]};
e++;
}
}
}
for(unsigned int j = 0; j < 9386; j++)
{
size_t found = input.find(i[j]);
while(found != string::npos)
{
counter += found + 1;
for(unsigned int b = (found+3); b<length; b++)
{
counter += found + 1;
}
found = input.find(i[j], found+1);
}
}
cout<<counter;
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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <iostream> #include <string> using namespace std; int main() { string input; cin >> input; unsigned int length = input.length(); unsigned long counter = 0; string i[9389]; string d = "aeiou"; unsigned int e = 0; // samogłoski for(int f = 0; f<5; f++) { for(int g = 0; g<5; g++) { for(int h = 0; h<5; h++) { i[e] = {d[f], d[g], d[h]}; e++; } } } // spółgłoski string k = "bcdfghjklmnpqrstvwxyz"; for(int f = 0; f<21; f++) { for(int g = 0; g<21; g++) { for(int h = 0; h<21; h++) { i[e] = {k[f], k[g], k[h]}; e++; } } } for(unsigned int j = 0; j < 9386; j++) { size_t found = input.find(i[j]); while(found != string::npos) { counter += found + 1; for(unsigned int b = (found+3); b<length; b++) { counter += found + 1; } found = input.find(i[j], found+1); } } cout<<counter; return 0; } |
English