You are given a string s consisting of lowercase English characters.
Rearrange only the vowels in the string so that they appear in non-increasing order of their frequency.
If multiple vowels have the same frequency, order them by the position of their first occurrence in s.
Return the modified string.
Vowels are 'a', 'e', 'i', 'o', and 'u'.
The frequency of a letter is the number of times it occurs in the string.
Example 1:
Input: s = "leetcode"
Output: "leetcedo"
Explanation:
['e', 'e', 'o', 'e'] with frequencies: e = 3, o = 1."leetcedo".Example 2:
Input: s = "aeiaaioooa"
Output: "aaaaoooiie"
Explanation:
['a', 'e', 'i', 'a', 'a', 'i', 'o', 'o', 'o', 'a'] with frequencies: a = 4, o = 3, i = 2, e = 1."aaaaoooiie".Example 3:
Input: s = "baeiou"
Output: "baeiou"
Explanation:
Constraints:
1 <= s.length <= 105s consists of lowercase English lettersLoading editor...
"leetcode"