Given a string, remove the vowels from the string.
Example 1:
Input: S = "welcome to geeksforgeeks"
Output: wlcm t gksfrgks
Explanation: Ignore vowels and print other
characters 
Example 2:
Input: S = "what is your name ?"
Output: wht s yr nm ?
Explanation: Ignore vowels and print other
characters 
Your task:
Your task is to complete the function removeVowels() which takes a single string as input and returns the modified string. You need not take any input or print anything.
Expected Time Complexity: O(|s|)
Expected Auxiliary Space: O(1)
Constraints:
1 <= |S| <= 10^{5}
Alphabets are lower cases only

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3

class Solution:

	def removeVowels(self, S):

		# code here

Solutions:
class Solution:

	def removeVowels(self, S):
		a = ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u']
		b = ''
		for i in S:
			if i not in a:
				b = b + i
		return b


class Solution:

	def removeVowels(self, s):
		ans = ''
		vowels = 'aeiou'
		for letters in s:
			if letters not in vowels:
				ans += letters
		return ans


class Solution:

	def removeVowels(self, S):
		st = ''
		vowels = 'AEIOUaeiou'
		for char in S:
			if char not in vowels:
				st += char
		return st


class Solution:

	def removeVowels(self, S):
		final = ''
		vowel = ['a', 'e', 'i', 'o', 'u']
		for i in S:
			if i in vowel:
				final += ''
			else:
				final += i
		return final


class Solution:

	def removeVowels(self, S):
		res = ''
		vowel = 'aeiou'
		for i in s:
			if i not in vowel:
				res += i
		return res


class Solution:

	def removeVowels(self, S):
		vowels = 'aeiouAEIOU'
		result = ''
		for Char in S:
			if Char not in vowels:
				result += Char
		return result


class Solution:

	def removeVowels(self, S):
		vow = {'a', 'e', 'i', 'o', 'u'}
		str = ''
		for i in S:
			if i not in vow:
				str += i
		return str


class Solution:

	def removeVowels(self, S):
		c = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		newstr = ''
		for i in range(len(S)):
			if S[i] not in c:
				newstr = newstr + S[i]
		return newstr


class Solution:

	def removeVowels(self, S):
		res = []
		for s in S:
			if s != 'a' and s != 'e' and (s != 'i') and (s != 'o') and (s != 'u'):
				res.append(s)
		return ''.join(res)


class Solution:

	def removeVowels(self, S):
		s = ''
		for i in S:
			if i in 'aeiou':
				s += ''
			else:
				s += i
		return s


class Solution:

	def removeVowels(self, S):
		temp = list(S)
		for i in range(len(S)):
			if temp[i] == 'a' or temp[i] == 'e' or temp[i] == 'i' or (temp[i] == 'o') or (temp[i] == 'u'):
				temp[i] = ''
			else:
				continue
		result = ''.join(temp)
		return result


class Solution:

	def removeVowels(self, S):
		l = 'AEIOUaeiou'
		g = ''
		for i in range(len(S)):
			if S[i] not in l:
				g += S[i]
			else:
				continue
		return g


class Solution:

	def removeVowels(self, S):
		t = ''
		v = ['a', 'e', 'i', 'o', 'u']
		for i in S:
			if i in v:
				continue
			else:
				t = t + i
		return t


class Solution:

	def removeVowels(self, S):
		i = 0
		res = ''
		for e in S:
			if e != 'a' and e != 'e' and (e != 'i') and (e != 'o') and (e != 'u'):
				res = res + e
		return res


class Solution:

	def removeVowels(self, S):
		vowels = 'aeiou'
		return ''.join([c for c in S if c not in vowels])


class Solution:

	def removeVowels(self, S):
		Vowels = ['a', 'e', 'i', 'o', 'u']
		n = ''
		for i in S:
			if i not in Vowels:
				n = n + i
		return n


class Solution:

	def removeVowels(self, S):
		V = ['a', 'e', 'i', 'o', 'u']
		s = ''
		for i in S:
			if i not in V:
				s += i
		return s


class Solution:

	def removeVowels(self, S):
		t = ''
		for c in S:
			for i in 'ieaouIEAOU':
				if c == i:
					c = ''
				else:
					c = c
			t = t + c
		return t


class Solution:

	def removeVowels(self, S):
		return ''.join(map(str, [i for i in S if i not in 'aeiou']))


class Solution:

	def removeVowels(self, S):
		s = ''
		v = ''
		for i in S:
			if i in 'AEIOUaeiou':
				v = v + i
			else:
				s = s + i
		return s


class Solution:

	def removeVowels(self, S):
		str = ''
		for i in S:
			if i not in 'aeiouAEIOU':
				str += i
		return str


class Solution:

	def removeVowels(self, S):
		s1 = 'AEIOUaeiou'
		string = ''
		for i in S:
			if i not in s1:
				string += i
		return string


class Solution:

	def removeVowels(self, S):
		vowels = ['a', 'e', 'i', 'o', 'u']
		result = ''
		for i in range(len(S)):
			if S[i] not in vowels:
				result += S[i]
		return result


class Solution:

	def removeVowels(self, S):
		s = ''
		for ele in S:
			if ele == 'a' or ele == 'e' or ele == 'i' or (ele == 'o') or (ele == 'u'):
				pass
			else:
				s += ele
		return s


class Solution:

	def removeVowels(self, S):
		k = ''
		for i in range(len(S)):
			if S[i] not in 'aeiou':
				k += S[i]
		return k


class Solution:

	def removeVowels(self, S):
		v = 'AEIOUaeiou'
		out = ''
		for i in range(len(S)):
			if S[i] not in v:
				out += s[i]
		return out


class Solution:

	def removeVowels(self, S):
		c = ''
		for i in S:
			if i not in 'aeiou':
				c += i
		return c


class Solution:

	def removeVowels(self, S):
		vovel = 'aeiou'
		for a in vovel:
			S = S.replace(a, '')
		return S


class Solution:

	def removeVowels(self, S):
		lst = ['a', 'e', 'i', 'o', 'u']
		str2 = ''
		for i in S:
			if i not in lst:
				str2 = str2 + i
		return str2


class Solution:

	def removeVowels(self, S):
		vowels = ['a', 'e', 'i', 'o', 'u']
		res = ''
		b = S.lower()
		for i in b:
			if i not in vowels:
				res = res + i
		return res


class Solution:

	def removeVowels(self, S):
		a = 'aeiou'
		s = ''
		for i in S:
			if i not in a:
				s = s + i
		return s


class Solution:

	def removeVowels(self, s):
		v = ''
		for i in s:
			if i in 'aeiou':
				pass
			else:
				v += i
		return v


class Solution:

	def removeVowels(self, s):
		vowels = ''
		for i in s:
			if i in 'aeiouAEIOU':
				vowels += i
		string = ''
		for i in s:
			if i not in 'aeiouAEIOU':
				string += i
		return string


class Solution:

	def removeVowels(self, S):
		s_str_list = list(str(S))
		vowels = 'aeiou'
		i = 0
		while i < len(s_str_list):
			if not vowels.find(s_str_list[i]) == -1:
				s_str_list.pop(i)
			else:
				i += 1
		return ''.join(s_str_list)


class Solution:

	def removeVowels(self, S):
		l = ''
		for i in range(len(S)):
			if S[i] in 'aeiou':
				continue
			else:
				l = l + S[i]
		return l


class Solution:

	def removeVowels(self, S):
		S = S.replace('a', '')
		S = S.replace('e', '')
		S = S.replace('i', '')
		S = S.replace('o', '')
		S = S.replace('u', '')
		S = S.replace('A', '')
		S = S.replace('E', '')
		S = S.replace('I', '')
		S = S.replace('O', '')
		S = S.replace('U', '')
		return S


class Solution:

	def removeVowels(self, S):
		t = ''
		for ch in s:
			if ch.lower() not in 'aueio':
				t += ch
		return t


class Solution:

	def removeVowels(self, S):
		s1 = 'aeiouAEIOU'
		l1 = []
		for i in s:
			if i not in s1:
				l1.append(i)
		return ''.join(l1)


class Solution:

	def removeVowels(self, S):
		vow = 'aeiou'
		res = ''
		for i in S:
			if i in vow:
				continue
			else:
				res += i
		return res


class Solution:

	def removeVowels(self, s):
		i = 0
		while i <= len(s) - 1:
			if s[i] in ('a', 'e', 'i', 'o', 'u') and i <= len(s) - 1:
				if i == len(s) - 1:
					s = s[0:i]
				else:
					s = s[0:i] + s[i + 1:]
			else:
				i += 1
		return s


class Solution:

	def removeVowels(self, S):
		new = ''
		for i in S:
			if i in ['a', 'e', 'i', 'o', 'u']:
				pass
			else:
				new += i
		return new


class Solution:

	def removeVowels(self, S):
		new = []
		vowels = ['a', 'e', 'i', 'o', 'u']
		for char in s:
			if char not in vowels:
				new.append(char)
		return ''.join(new)


class Solution:

	def removeVowels(self, S):
		return S.replace('a', '').replace('e', '').replace('i', '').replace('o', '').replace('u', '')


class Solution:

	def removeVowels(self, S):
		str = ''
		l = len(S)
		v = ['a', 'e', 'i', 'o', 'u']
		for i in S.lower():
			if i not in v:
				str += i
		return str


class Solution:

	def removeVowels(self, S):
		st = ''
		for i in S:
			if i not in ['a', 'e', 'i', 'o', 'u']:
				st += i
		return st


class Solution:

	def removeVowels(self, S):
		res = ''
		for i in S:
			if i not in 'aeuoi':
				res += i
		return res


class Solution:

	def removeVowels(self, S):
		return ''.join((i for i in S if i.lower() not in 'aeiou'))


class Solution:

	def removeVowels(self, S):
		v = 'aeiouAEIOU'
		l = []
		for i in S:
			if i not in v:
				l.append(i)
		return ''.join(l)


class Solution:

	def removeVowels(self, S):
		ans = ''
		for i in range(len(S)):
			if s[i] in ['a', 'e', 'i', 'o', 'u']:
				pass
			else:
				ans += s[i]
		return ans


class Solution:

	def removeVowels(self, S):
		newstr = ''
		for i in range(0, len(S)):
			if S[i] != 'a' and S[i] != 'e' and (S[i] != 'i') and (S[i] != 'o') and (S[i] != 'u'):
				newstr = newstr + S[i]
		return newstr


class Solution:

	def removeVowels(self, S):
		res = ''
		vow = 'aeoiu'
		for i in S:
			if i not in vow:
				res += i
		return res


class Solution:

	def removeVowels(self, S):
		lut = 'aeiou'
		RES = ''
		for L in S:
			if L in lut:
				continue
			RES = RES + L
		return RES


class Solution:

	def removeVowels(self, S):
		word = ''
		for i in range(len(S)):
			if S[i] not in set('aeiouAEIOU'):
				word = word + S[i]
			else:
				continue
		return word


class Solution:

	def removeVowels(self, S):
		out_str = ''
		vowels = ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U')
		for char in S:
			if char not in vowels:
				out_str += char
		return out_str


def isVowel(char):
	vowels = 'aeiouAEIOU'
	if char in vowels:
		return True
	else:
		return False

class Solution:

	def removeVowels(self, S):
		newstr = []
		for i in S:
			if isVowel(i) == 0:
				newstr.append(i)
		ans = ''.join(newstr)
		return ans


class Solution:

	def removeVowels(self, S):
		result = ''
		for i in range(len(s)):
			if s[i] not in 'aeiou':
				result = result + s[i]
		return result


class Solution:

	def removeVowels(self, S):
		vowels = ['a', 'e', 'i', 'o', 'u']
		ans = ''
		for char in S:
			if char not in vowels:
				ans += char
		return ans


class Solution:

	def removeVowels(self, S):
		vowels = list('aeiou')
		l = []
		for i in S:
			if i not in vowels:
				l.append(i)
		return ''.join(l)


class Solution:

	def removeVowels(self, S):
		ls = []
		for i in range(len(S)):
			if S[i] not in ['a', 'e', 'i', 'o', 'u']:
				ls.append(S[i])
		return ''.join(ls)


class Solution:

	def removeVowels(self, s):
		s1 = 'AEIOUaeiou'
		s2 = ''
		for i in s:
			if i not in s1:
				s2 += i
		return s2


class Solution:

	def removeVowels(self, S):
		st1 = ''
		st = 'aeiou'
		for i in S:
			if i not in st:
				st1 += i
		return st1


class Solution:

	def removeVowels(self, s):
		res = ''
		li = ['a', 'e', 'i', 'o', 'u']
		for i in s:
			if i in li:
				continue
			else:
				res += i
		return res


class Solution:

	def removeVowels(self, S):
		vowels = ['a', 'i', 'e', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		l = list(S)
		res = ''
		for i in l:
			if i in vowels:
				continue
			else:
				res += i
		return res


class Solution:

	def removeVowels(self, S):
		new_s = ''
		for i in range(len(S)):
			if S[i] != 'a' and S[i] != 'e' and (S[i] != 'i') and (S[i] != 'o') and (S[i] != 'u'):
				new_s += S[i]
			else:
				continue
		return new_s


class Solution:

	def removeVowels(self, S):
		v = ['a', 'e', 'i', 'o', 'u']
		ch = ''
		str = ''
		for i in S:
			if i not in v:
				ch += i
			else:
				str += ch
				ch = ''
		return str + ch


class Solution:

	def removeVowels(self, S):
		lst = list(s)
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		a = ''
		for i in lst:
			if i not in v:
				a += i
		return a


class Solution:

	def removeVowels(self, S):
		h = ['a', 'e', 'o', 'i', 'u']
		l = []
		k = []
		for c in S:
			l.append(c)
		for c in l:
			if c not in h:
				k.append(c)
		r = ''
		for x in k:
			r = r + x
		return r