Given a 0-indexed string `s`, permute it to get a new string `t` such that every consonant stays in its original place, and the vowels are sorted in nondecreasing order of their ASCII values. That is, for any two vowel positions `i < j`, `t[i]` must not have a higher ASCII value than `t[j]`. The vowels are `a`, `e`, `i`, `o`, `u` in lowercase or uppercase; every other letter is a consonant. Return the resulting string.
Given a 0-indexed string s, permute it to get a new string t such that every consonant stays in its original place, and the vowels are sorted in nondecreasing order of their ASCII values. That is, for any two vowel positions i < j, t[i] must not have a higher ASCII value than t[j]. The vowels are a, e, i, o, u in lowercase or uppercase; every other letter is a consonant. Return the resulting string.
Example 1:
Input: {"s":"lEetcOde"}
Output: lEOtcede
Constraints:
1 <= s.length <= 10^5
s consists only of letters of the English alphabet in uppercase and lowercase.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"s":"lEetcOde"}
Set up 10 buckets in ASCII order, A E I O U a e i o u. This string has 4 vowels; the 4 consonants never move.
s: lifting vowels into buckets
scanned 0/8
0
l
E
e
t
c
5
O
d
e
vowel buckets in ASCII order (k walks left to right)