Write a Python function that takes a string s and returns a new string with all vowels (both lowercase and uppercase) removed. The vowels are a, e, i, o, u and their uppercase counterparts. The function should handle any input string and keep the non-vowel characters in their original order.
Function Signature
def remove_vowels(s: str) -> str:
...
Rules
-
The ten vowel characters are
a
,
e
,
i
,
o
,
u
,
A
,
E
,
I
,
O
,
U
. The letter
y
is not a vowel.
-
Every other character, including spaces, digits and punctuation, stays in the output in its original relative order.
-
If
s
is empty or contains only vowels, return the empty string.
Constraints
Examples
Input: s = "hello"
Output: "hll"
Removing e and o leaves h, l, l in their original order.
Input: s = "AEIOUaeiou"
Output: ""
Every character is a vowel, so nothing is left.
Input: s = "Python 3.12!"
Output: "Pythn 3.12!"
Only the o is removed. The y, the space, the digits and the punctuation all stay where they were.