/
beekeeper.cpp
44 lines (33 loc) · 917 Bytes
/
beekeeper.cpp
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
#include <iostream>
using namespace std;
char VOWELS[6] = {'a', 'e', 'i', 'o', 'u', 'y'};
int main()
{
freopen("C:\\Users\\Akhilesh\\Desktop\\input.txt", "r", stdin);
int N;
cin >> N;
while (N != 0) {
string bestString = "";
int best = 0;
for (int i = 0; i < N; i++) {
string S;
cin >> S;
if (bestString.size() == 0)
bestString = S;
int current = 0;
for (int j = 0; j < S.size() - 1; j++) {
for (char v : VOWELS) {
if (S[j] == v && S[j+1] == v)
current++;
}
}
if (current > best) {
best = current;
bestString = S;
}
}
cout << bestString << "\n";
cin >> N;
}
return 0;
}