Remove Vowels from a String

easy string filter

Problem

Given a string s, remove all lowercase vowels from it. The vowels to remove are 'a', 'e', 'i', 'o', and 'u'. Return the new string after removing these vowels, keeping all other characters in their original order.

Inputs = "leetcode"
Output"ltcd"
The vowels e, e, o, e are dropped; l, t, c, d remain in order.

def remove_vowels(s):
    vowels = set("aeiou")
    out = []
    for c in s:
        if c not in vowels:
            out.append(c)
    return "".join(out)
function removeVowels(s) {
  const vowels = new Set(["a", "e", "i", "o", "u"]);
  let out = "";
  for (const c of s) {
    if (!vowels.has(c)) out += c;
  }
  return out;
}
class Solution {
    public String removeVowels(String s) {
        StringBuilder out = new StringBuilder();
        for (char c : s.toCharArray()) {
            if ("aeiou".indexOf(c) == -1) out.append(c);
        }
        return out.toString();
    }
}
string removeVowels(string s) {
    string vowels = "aeiou";
    string out;
    for (char c : s) {
        if (vowels.find(c) == string::npos) out += c;
    }
    return out;
}
Time: O(n) Space: O(n)