#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <string>
#include <vector>
#include <map>
bool is_vowels(char ch){
return (ch == 'e') || (ch == 'u') || (ch == 'i') || (ch == 'o') ||(ch == 'a');
}
void out(const std::pair<std::string, int> &rhs){
std::cout << rhs.first << "\t "
<< rhs.second
<< " : "<< (rhs.first.size() - rhs.second)
<< std::endl;
}
int main(){
std::string rhs = "Testing Line Andrew maaaax";
std::stringstream ss(rhs);
std::map<std::string, int> map;
std::map<std::string, int>::iterator im, max;
std::vector<std::string> res;
std::vector<std::string>::iterator i;
std::copy(std::istream_iterator<std::string>(ss),
std::istream_iterator<std::string>(),
std::back_inserter(res));
i = res.begin();
for(; i != res.end(); ++i)
map[*i] = count_if((*i).begin(), (*i).end(), is_vowels);
im = max = map.begin();
for(; im != map.end(); ++im){
out(*im);
if((*im).second > (*max).second)
max = im;
}
std::cout << "Max: \n";
out(*max);
return 0;
}