You are given N strings and you have to sort the strings according to the following rules.
S1<S2ifS1has fewer vowels thanS2.- If the number of vowels are equal then,
S1<S2ifS1has fewer number of words. - If both the above are tied, then the string with the longest word is greater.
- else the strings are equal.
The number of words in the string does not exceed 10. Each word does not have more than 10 letters.
You need to output the sorted set of strings. N <= 100000.
The sorting has to be stable
aa
bda dks
cabd ekdls lmnk
bda dks
aa
cabd ekdls lmnk