fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. int counter(string a){
  8. int c = 0;
  9. for (unsigned int i = 0; i < a.length(); i++){
  10. if (a[i]=='e'||'u'==a[i]||'o'==a[i]||'i'==a[i]||'a'==a[i]){
  11. c++;
  12. }
  13. }
  14. return c;
  15. }
  16. bool mod(string a, string b){
  17. return counter(a) > counter(b);
  18. }
  19. int main() {
  20. vector <string> Words;
  21. string word;
  22. for (unsigned int i=0; cin >> word; i++){
  23. Words.push_back(word);
  24. }
  25. sort(Words.begin(),Words.end(), mod);
  26. for(auto i: Words){
  27. cout << i <<endl;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 3484KB
stdin
For never was a story of more woe
Than this of Juliet and her Romeo.
stdout
Juliet
Romeo.
never
more
woe
For
was
a
story
of
Than
this
of
and
her