Flip Only Vowels
Here you reverse only the vowels in a string while every other character stays in its original position. The function reverse_vowel receives a string s. Treat a, e, i, o, and u as vowels in both lowercase and uppercase. Return a new string where the vowels appear in reverse order.
Примеры
Ввод
["hello"]Вывод
"holle"Ввод
["leetcode"]Вывод
"leotcede"Ввод
["aA"]Вывод
"Aa"Нужно реализовать
def reverse_vowel(s: str) -> str:
Теги
stringstwo-pointers
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
"hello"Expected
"holle"2
Input
"leetcode"Expected
"leotcede"3
Input
"aA"Expected
"Aa"4
Input
"bcd"Expected
"bcd"5
Input
"edocteel"Expected
"edectoel"6
Input
"Hello, World!"Expected
"Hollo, Werld!"Focus radio
Paused · SomaFM · Fluid