0 out of 464 challenges solved
Write a Python function `reverse_vowels(s: str) -> str` that takes a string `s` as input and returns a new string where only the vowels in `s` are reversed, while the positions of all other characters remain unchanged. Vowels are defined as `a, e, i, o, u` (both uppercase and lowercase). The letter `y` is not considered a vowel.
#### Example Usage
```python [main.nopy]
reverse_vowels("hello") # Output: "holle"
reverse_vowels("Python") # Output: "Python"
reverse_vowels("USA") # Output: "ASU"
```
#### Constraints
- The input string `s` will only contain printable ASCII characters.
- The function should be case-sensitive (i.e., `A` and `a` are treated as vowels, but `A` is not equal to `a`).def reverse_vowels(s: str) -> str:
"""
Reverse only the vowels in the input string.
Args:
s (str): The input string.
Returns:
str: The string with vowels reversed.
"""
# Define vowels
vowels = "aeiouAEIOU"
# Placeholder for solution
pass