Link Problem: https://open.kattis.com/problems/beekeeper
Files submitted
#include<bits/stdc++.h>
using namespace std;
bool vowels(char x){
string s= "aeiouy";
for(int i=0; s[i]; i++)
if (s[i]==x) return true;
return false;
}
int f(string s){
int cnt= 0;
for(int i=0; s[i+1]; i++)
if (s[i]==s[i+1] && vowels(s[i])){
i++;
cnt++;
}
return cnt;
}
int main(){
int n;
while(cin >> n && n){
string res;
int MAX= -1; //0 => wa
for(int i=1; i<=n; i++){
string s; cin >> s;
if (f(s) > MAX){
MAX = f(s);
res= s;
}
}
cout<<res<<"\n";
}
}
No comments:
Post a Comment