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
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible 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