5. Reverse Vowels of a String
Return s with only its vowels reversed: the first vowel swaps with the last vowel, the
second with the second-to-last, and so on. Everything else stays where it is.
The vowels are a, e, i, o, u, in lowercase or uppercase.
Constraints
1 <= len(s) <= 300000scontains printable ASCII characters.
Examples
Example 1
Input: s = "sunrise" Output: "senrisu"
Example 2
Input: s = "Programming" Output: "Prigrammong"
Example 3
Input: s = "rhythm" Output: "rhythm"
Hints
Hint 1
Use two pointers, one from each end, that skip over consonants.
Hint 2
Vowels can be upper or lower case.