1119. Remove Vowels from a String
Contents
Problem
Given a string S, remove the vowels a, e, i, o, and u from it, and return the new string.
example 1
Input: "leetcodeisacommunityforcoders"
Output: "ltcdscmmntyfrcdrs"example 2
Input: "aeiou"
Output: ""Constraints
Sconsists of lowercase English letters only.- 1 <=
len(S)<= 1000
Solution
Walk throw string and remove vowels
func removeVowels(S string) string {
res := ""
for idx:=range S {
if S[idx] != 'a' && S[idx] != 'e' && S[idx] != 'i' && S[idx] != 'o' && S[idx] != 'u' {
res += string(S[idx])
}
}
return res
}