Given a string consisting of lowercase english alphabets, reverse only the vowels present in it and print the resulting string.
Example 1:
Input:
S = "geeksforgeeks"
Output: geeksforgeeks
Explanation: The vowels are: e, e, o, e, e
Reverse of these is also e, e, o, e, e.
Example 2:
Input: 
S = "practice"
Output: prectica
Explanation: The vowels are a, i, e
Reverse of these is e, i, a.
 
Example 3:
Input: 
S = "bcdfg"
Output: bcdfg
Explanation: There are no vowels in S.
Your Task:
You don't need to read input or print anything. Your task is to complete the function modify() which takes the string S as input and returns the resultant string by reversing only the vowels present in S.
Expected Time Complexity: O(|S|).
Expected Auxiliary Space: O(|S|).
Constraints:
1<=|S|<=10^{5}

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3



class Solution:

    def modify(self, s):

        # code here

Solutions:
class Solution:

	def modify(self, s):
		l1 = []
		l2 = []
		S = list(s)
		v = ['a', 'e', 'i', 'o', 'u']
		for i in range(len(s)):
			if s[i] in v:
				l1.append(s[i])
				l2.append(i)
		l1.reverse()
		for i in range(len(l2)):
			S[l2[i]] = l1[i]
		return ''.join(S)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		s = list(s)
		i = 0
		j = len(s) - 1
		while i < j:
			if s[i] in vowels and s[j] in vowels:
				val = s[i]
				s[i] = s[j]
				s[j] = val
				i += 1
				j -= 1
			if s[i] not in vowels:
				i += 1
			if s[j] not in vowels:
				j -= 1
		return ''.join(s)


class Solution:

	def modify(self, s):
		a = ''
		for i in s:
			if i in ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u']:
				a += i
		a = a[::-1]
		index = 0
		os = ''
		for i in s:
			if i not in ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u']:
				os += i
			else:
				os += a[index]
				index += 1
		return os


class Solution:

	def modify(self, s):
		s_str_list = list(str(s))
		result = ''
		i = 0
		j = len(s_str_list) - 1
		encontrado_i = False
		encontrado_j = False
		while i < j:
			if s_str_list[i] in 'aeiou':
				encontrado_i = True
			else:
				encontrado_i = False
				i += 1
			if s_str_list[j] in 'aeiou':
				encontrado_j = True
			else:
				encontrado_j = False
				j -= 1
			if encontrado_i and encontrado_j:
				(s_str_list[i], s_str_list[j]) = (s_str_list[j], s_str_list[i])
				i += 1
				j -= 1
		return ''.join(s_str_list)


class Solution:

	def modify(self, s):
		lst = []
		s1 = ''
		for i in s:
			if i in 'aeiou':
				lst.append(i)
				s1 += '_'
			else:
				s1 += i
		lst = lst[::-1]
		s = ''
		c = 0
		for i in s1:
			if i == '_':
				s += lst[c]
				c += 1
			else:
				s += i
		return s


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		string_list = list(s)
		left = 0
		right = len(s) - 1
		while left < right:
			if string_list[left] in vowels and string_list[right] in vowels:
				(string_list[left], string_list[right]) = (string_list[right], string_list[left])
				left += 1
				right -= 1
			elif string_list[left] in vowels:
				right -= 1
			else:
				left += 1
		return ''.join(string_list)


class Solution:

	def modify(self, s):
		vow = ''
		for i in s:
			if i in 'aeiou':
				vow += i
		vow = vow[::-1]
		k = 0
		l = ''
		for i in range(len(s)):
			if s[i] in 'aeiou':
				l += vow[k]
				k += 1
			else:
				l += s[i]
		return l


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		lv = []
		result = ''
		for char in s:
			if char in vowels:
				lv.append(char)
		j = len(lv) - 1
		for char in s:
			if char in vowels:
				result += lv[j]
				j -= 1
			else:
				result += char
		return result


class Solution:

	def modify(self, s):
		vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'])
		stack = []
		for ch in s:
			if ch in vowels:
				stack.append(ch)
		res = ''
		for ch in s:
			if ch in vowels:
				res += stack.pop()
			else:
				res += ch
		return res


class Solution:

	def modify(self, s):
		k = 0
		lt = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		vlt = []
		ltstr = ''
		for i in s:
			if i in lt:
				vlt.insert(0, i)
		for i in range(len(s)):
			if s[i] in lt:
				ltstr = ltstr + vlt[k]
				k += 1
			else:
				ltstr = ltstr + s[i]
		return ltstr


class Solution:

	def modify(self, s):
		vow = ['a', 'e', 'i', 'o', 'u']
		st = set(vow)
		vow = ''
		for i in s:
			if i in st:
				vow = vow + i
		vow = vow[::-1]
		os = ''
		ind = 0
		for i in s:
			if i not in st:
				os = os + i
			else:
				os = os + vow[ind]
				ind = ind + 1
		return os


class Solution:

	def modify(self, s):
		S = []
		S[:0] = s
		vowel_s = []
		vowel_index = []
		for i in range(len(s)):
			if s[i] in 'aeiou':
				vowel_s.append(s[i])
				vowel_index.append(i)
		vowel_s.reverse()
		for i in range(len(vowel_s)):
			S[vowel_index[i]] = vowel_s[i]
		return ''.join(S)


class Solution:

	def modify(self, s):
		lst = list(s)
		vowel = set('aeiou')
		left = 0
		right = len(lst) - 1
		while left <= right:
			while left <= right and lst[left] not in vowel:
				left += 1
			while left <= right and lst[right] not in vowel:
				right -= 1
			if left > right:
				break
			(lst[left], lst[right]) = (lst[right], lst[left])
			left += 1
			right -= 1
		return ''.join(lst)


class Solution:

	def modify(self, s):
		vowels = 'aeiou'
		stack = [c for c in s if c in vowels]
		return ''.join((stack.pop() if c in vowels else c for c in s))


class Solution:

	def modify(self, S):
		vowels = ['a', 'e', 'i', 'o', 'u']
		reversed_vowels = []
		for ch in S:
			if ch in vowels:
				reversed_vowels.append(ch)
		result = ''
		for i in range(len(S)):
			if S[i] in vowels:
				result += reversed_vowels.pop()
			else:
				result += S[i]
		return result


class Solution:

	def modify(self, s):
		vowels = ''
		for c in s:
			if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u'):
				vowels = vowels + c
		vowels = vowels[::-1]
		start = 0
		res = ''
		for c in s:
			ele = c
			if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u'):
				ele = vowels[start]
				start = start + 1
			res = res + ele
		return res


class Solution:

	def modify(self, s):
		li = list(s)
		i = 0
		j = len(li) - 1
		while i < j:
			if li[i] in ['a', 'e', 'i', 'o', 'u'] and li[j] in ['a', 'e', 'i', 'o', 'u']:
				temp = li[i]
				li[i] = li[j]
				li[j] = temp
				i += 1
				j -= 1
			elif li[i] not in ['a', 'e', 'i', 'o', 'u']:
				i += 1
			else:
				j -= 1
		return ''.join(li)


class Solution:

	def modify(self, s):
		vowel = ['a', 'e', 'i', 'o', 'u']
		s = list(s)
		new = []
		for i in range(len(s)):
			if s[i] in vowel:
				new.append(s[i])
		j = len(new) - 1
		for i in range(len(s)):
			if s[i] in vowel:
				s[i] = new[j]
				j -= 1
		return ''.join(s)


class Solution:

	def modify(self, s):
		lst = []
		lst1 = ['a', 'e', 'i', 'o', 'u']
		s1 = ''
		for ele in s:
			if ele in lst1:
				lst.append(ele)
		lst = lst[::-1]
		for i in range(len(s)):
			if s[i] in lst1:
				s1 += lst[0]
				lst.pop(0)
			else:
				s1 += s[i]
		return s1


class Solution:

	def modify(self, s):
		vowels = []
		for i in s:
			if i in 'aeiou':
				vowels.append(i)
		res = ''
		k = len(vowels) - 1
		for i in s:
			if i in 'aeiou':
				res += vowels[k]
				k -= 1
			else:
				res += i
		return res


class Solution:

	def modify(self, s):
		li = []
		st = 'aeiouAEIOU'
		for i in s:
			if i in st:
				li.append(i)
		res = ''
		for i in s:
			if i in st:
				res += li.pop()
			else:
				res += i
		return res


class Solution:

	def modify(self, string):

		def isVowel(c):
			if c == 'a' or c == 'A' or c == 'e' or (c == 'E') or (c == 'i') or (c == 'I') or (c == 'o') or (c == 'O') or (c == 'u') or (c == 'U'):
				return True
			return False
		j = 0
		vowel = [0] * len(string)
		string = list(string)
		for i in range(len(string)):
			if isVowel(string[i]):
				vowel[j] = string[i]
				j += 1
		for i in range(len(string)):
			if isVowel(string[i]):
				j -= 1
				string[i] = vowel[j]
		return ''.join(string)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		s_vowels_record = []
		for i in range(len(s)):
			if s[i] in vowels:
				s_vowels_record.append(s[i])
		s_vowels_record.reverse()
		counter = 0
		result = ''
		for i in range(len(s)):
			if s[i] in vowels:
				result += s_vowels_record[counter]
				counter += 1
			else:
				result += s[i]
		return result


class Solution:

	def modify(self, s):
		vowels = ' '
		for char in s:
			if char in 'aeiouAEIOU':
				vowels += char
		res = ''
		for char in s:
			if char in 'aeiouAEIOU':
				res += vowels[-1]
				vowels = vowels[:-1]
			else:
				res += char
		return res


class Solution:

	def modify(self, s):
		v = 'aeiou'
		v1 = ''
		for i in s:
			if i in v:
				v1 += i
		v2 = v1[-1::-1]
		ans = ''
		a = 0
		for i in range(0, len(s)):
			if s[i] not in v:
				ans += s[i]
			else:
				ans += v2[a]
				a += 1
		return ans


class Solution:

	def modify(self, s):
		res_vow = ''
		res = ''
		vow = set('aeiouAEIOU')
		for i in s:
			if i in vow:
				res_vow += i
		for i in s:
			if i in vow:
				res = res + res_vow[-1]
				res_vow = res_vow[:-1]
			else:
				res = res + i
		return res


class Solution:

	def modify(self, s):
		new = ''
		fin = ''
		for i in s:
			if i in 'aeiou':
				new += i
		new = new[::-1]
		k = 0
		for j in s:
			if j in 'aeiou':
				fin += new[k]
				k = k + 1
			else:
				fin += j
		return fin


class Solution:

	def modify(self, s):
		v = ''
		for i in s:
			if i in 'aeiou':
				v += i
		v = v[::-1]
		ss = ''
		k = 0
		for i in s:
			if i in 'aeiou':
				ss += v[k]
				k += 1
			else:
				ss += i
		return ss


class Solution:

	def modify(self, s):
		l = list(s)
		i = 0
		j = len(l) - 1
		while i < j:
			if l[i] not in 'aeiouAEIOU':
				i += 1
			elif l[j] not in 'aeiouAEIOU':
				j -= 1
			else:
				(l[i], l[j]) = (l[j], l[i])
				i += 1
				j -= 1
		return ''.join(l)


class Solution:

	def modify(self, s):
		(l1, l2, n) = ([], [], 0)
		for i in s:
			if i in 'aeiou':
				l1 += i
		l1.reverse()
		for i in s:
			if i in 'aeiou':
				l2 += l1[n]
				n += 1
			else:
				l2 += i
		return ''.join(l2)


class Solution:

	def modify(self, s: str) -> str:
		vow = ''
		for i in range(len(s)):
			if s[i] in ['a', 'e', 'i', 'o', 'u']:
				vow += s[i]
				s = s[:i] + '.' + s[i + 1:]
		i = len(s) - 1
		j = 0
		while i >= 0:
			if s[i] == '.':
				s = s[:i] + vow[j] + s[i + 1:]
				j += 1
			i -= 1
		return s


class Solution:

	def modify(self, s):
		vowels = []
		vow = ['a', 'e', 'i', 'o', 'u']
		for i in range(0, len(s)):
			if s[i] in vow:
				vowels.append(s[i])
		vowels = vowels[::-1]
		lst = list(s)
		x = 0
		for i in range(0, len(lst)):
			if lst[i] in vow:
				lst[i] = vowels[x]
				x += 1
		return ''.join(lst)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		vow = []
		rev = ''
		for i in s:
			if i in vowels:
				vow.append(i)
		rev = ''.join(reversed(vow))
		s = list(s)
		for i in range(len(s)):
			if s[i] in vowels:
				s[i] = rev[0]
				rev = rev[1:]
				if len(rev) == 0:
					break
		return ''.join(s)


class Solution:

	def modify(self, s):
		m = ''
		for i in s:
			if i.lower() in 'aeiou':
				m += i
		m = m[::-1]
		l = 0
		kv = ''
		for i in range(len(s)):
			if s[i] in 'aeiou':
				kv += m[l]
				l = l + 1
			else:
				kv += s[i]
		return kv


class Solution:

	def modify(self, str1):
		vowels = ''
		for i in s:
			if i in 'aeiouAEIOU':
				vowels += i
		string = ''
		for i in s:
			if i in 'aeiouAEIOU':
				string += vowels[-1]
				vowels = vowels[:-1]
			else:
				string = string + i
		return string


class Solution:

	def modify(self, s):
		v = ' '
		c = 0
		for i in s:
			if i.lower() in 'aeiou':
				v += i
		v = v[::-1]
		l = 0
		nv = ''
		for i in range(len(s)):
			if s[i] in 'aeiou':
				nv += v[l]
				l += 1
			else:
				nv += s[i]
		return nv


class Solution:

	def modify(self, s):
		x = ''
		y = ''
		j = 0
		vow = 'aeiou'
		for i in s:
			if vow.count(i):
				x = str(i) + x
		for i in s:
			if vow.count(i):
				y = y + x[j]
				j += 1
			else:
				y += i
		return y


class Solution:

	def modify(self, s):
		x = []
		v = 'aeiou'
		l = []
		for i in s:
			if i in v:
				x.append(1)
				l.append(i)
			else:
				x.append(i)
		l.reverse()
		c = 0
		for i in range(0, len(x)):
			if x[i] == 1:
				x[i] = l[c]
				c += 1
		return ''.join(x)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		present = []
		for i in s:
			if i in vowels:
				present.append(i)
		present.reverse()
		x = 0
		out = ''
		for i in s:
			if i in vowels:
				out += present[x]
				x += 1
			else:
				out += i
		return out


class Solution:

	def modify(self, s):
		v = ['a', 'e', 'i', 'o', 'u']
		st = ''
		for i in range(len(s)):
			if s[i] in v:
				st += s[i]
		st1 = ''
		c = 0
		for i in range(len(s)):
			if s[i] in st:
				st1 += st[len(st) - 1 - c]
				c += 1
			else:
				st1 += s[i]
		return st1


class Solution:

	def modify(self, s):
		li = ['a', 'e', 'i', 'o', 'u']
		st = ''
		for i in s:
			if i in li:
				st += i
		st1 = st[::-1]
		ans = ''
		j = 0
		for i in range(len(s)):
			if s[i] not in li:
				ans += s[i]
			else:
				ans += st1[j]
				j += 1
		return ans


class Solution:

	def modify(self, s):
		x = ['a', 'e', 'i', 'u', 'o', 'A', 'E', 'I', 'U', 'O']
		s = list(s)
		v = []
		for i in s:
			if i in x:
				v.append(i)
		v.reverse()
		j = 0
		for i in range(len(s)):
			if s[i] in x:
				s[i] = v[j]
				j += 1
		return ''.join(s)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		s = list(s)
		j = 0
		sequence = []
		for i in range(len(s)):
			if s[i] in vowels:
				sequence.append(s[i])
		revseq = list(reversed(sequence))
		for i in range(len(s)):
			if s[i] in vowels:
				s[i] = revseq[j]
				j += 1
		return ''.join(s)


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		vow = []
		for c in s:
			if c in vowels:
				vow.append(c)
				s = s.replace(c, ' ')
		ans = [i for i in s]
		for i in range(len(ans)):
			if ans[i] == ' ':
				ans[i] = vow.pop()
		return ''.join(ans)


class Solution:

	def modify(self, s):
		vowels = 'aeiouAEIOU'
		vowels_list = [char for char in s if char in vowels]
		vowels_list.reverse()
		for i in range(len(s)):
			if s[i] in vowels:
				s = s[:i] + vowels_list.pop(0) + s[i + 1:]
		return s


class Solution:

	def modify(self, s):
		vowels = []
		for i in s:
			if i in ['a', 'e', 'i', 'o', 'u']:
				vowels.append(i)
		st = ''
		for i in s:
			if i in ['a', 'e', 'i', 'o', 'u']:
				st += vowels.pop()
			else:
				st += i
		return st


class Solution:

	def modify(self, s):
		vow = 'aeiou'
		v = ''
		for i in s:
			if i in vow:
				v += i
		vrev = v[::-1]
		j = 0
		res = ''
		for i in s:
			if i in vow:
				res += vrev[j]
				j += 1
			else:
				res += i
		return res


class Solution:

	def modify(self, s):
		l = []
		for i in s:
			if i in 'aeiou':
				l.insert(0, i)
		a = ''
		num = 0
		for i in s:
			if i in 'aieou':
				a += l[num]
				num += 1
			else:
				a += i
		return a


class Solution:

	def modify(self, s):
		vow = 'aeiou'
		v = []
		lst = list(map(str, s))
		for i in range(len(lst)):
			if lst[i] in vow:
				v.append(lst[i])
		vlist = v[::-1]
		j = 0
		for i in range(len(lst)):
			if lst[i] in vow:
				lst[i] = vlist[j]
				j += 1
		return ''.join(lst)


class Solution:

	def modify(self, s):
		li = []
		str1 = ''
		s = list(s)
		for i in s:
			if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u'):
				li.append(i)
		li.reverse()
		j = 0
		for i in range(len(s)):
			if s[i] == 'a' or s[i] == 'e' or s[i] == 'i' or (s[i] == 'o') or (s[i] == 'u'):
				s[i] = li[j]
				j += 1
		for i in s:
			str1 += i
		return str1


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		v = []
		for i in s:
			if i in vowels:
				v.append(i)
		v.reverse()
		sol = ''
		f = 0
		for i in s:
			if i not in vowels:
				sol += i
			else:
				k = v[f]
				sol += k
				f += 1
		return sol


class Solution:

	def modify(self, s):
		v = ['a', 'e', 'i', 'o', 'u']
		q = []
		for i in range(len(s)):
			if s[i] in v:
				q.append(s[i])
		q.reverse()
		c = 0
		r = ''
		for i in range(len(s)):
			if s[i] in v:
				r += q[c]
				c += 1
			else:
				r += s[i]
		return r


class Solution:

	def modify(self, s):
		U = ['_'] * len(s)
		s1 = []
		s2 = []
		for i in range(len(s)):
			if s[i] not in set('aeiouAEIOU'):
				U[i] = s[i]
			else:
				s2.append(s[i])
				s1.append(i)
		x = s2[::-1]
		for i in range(len(s1)):
			U[s1[i]] = x[i]
		return ''.join(U)


class Solution:

	def modify(self, s):
		ans = ''
		s1 = s[::-1]
		lst = []
		vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		for i in s1:
			if i in vowels:
				lst.append(i)
		count = 0
		for j in s:
			if j not in vowels:
				ans += j
			else:
				ans += lst[count]
				count += 1
		return ans


class Solution:

	def modify(self, s):
		vowels = ('a', 'e', 'i', 'o', 'u')
		inp_str_list = list(s)
		start_index = 0
		end_index = len(s) - 1
		while start_index < end_index:
			if inp_str_list[start_index] not in vowels:
				start_index += 1
			elif inp_str_list[end_index] not in vowels:
				end_index -= 1
			else:
				(inp_str_list[start_index], inp_str_list[end_index]) = (inp_str_list[end_index], inp_str_list[start_index])
				start_index += 1
				end_index -= 1
		return ''.join(inp_str_list)


class Solution:

	def modify(self, s):
		vowels = ('a', 'e', 'i', 'o', 'u')
		inp_str_list = list(s)
		index_list = []
		for count in range(len(s)):
			if inp_str_list[count] in vowels:
				index_list.append(count)
		for count_index in range(len(index_list) // 2):
			temp_var = inp_str_list[index_list[count_index]]
			inp_str_list[index_list[count_index]] = inp_str_list[index_list[-count_index - 1]]
			inp_str_list[index_list[-count_index - 1]] = temp_var
		return ''.join(inp_str_list)


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

class Solution:

	def modify(self, s):
		Vowels = []
		for i in s:
			if isVowel(i) == 1:
				Vowels.append(i)
		ans = []
		count = 0
		Vowels[::1] = Vowels[::-1]
		for i in s:
			if isVowel(i) == 1:
				ans.append(Vowels[count])
				count += 1
			else:
				ans.append(i)
		rans = ''.join(ans)
		return rans


class Solution:

	def modify(self, s):
		lut = 'aeiou'
		vowels = [letter for letter in s if letter in lut]
		res = ''
		for letter in s:
			if letter in lut:
				res = res + vowels.pop(-1)
			else:
				res = res + letter
		return res


class Solution:

	def modify(self, s):
		v = ['a', 'e', 'i', 'o', 'u']
		l = []
		for i in s:
			if i in v:
				l.append(i)
		str = ''
		for i in range(len(s)):
			if s[i] in v:
				str += l.pop()
			else:
				str += s[i]
		return str


class Solution:

	def modify(self, s):
		vowels = []
		noIndex = []
		newList = list(s)
		for i in range(len(s)):
			if s[i] == 'a' or s[i] == 'e' or s[i] == 'i' or (s[i] == 'o') or (s[i] == 'u'):
				vowels.append(s[i])
				noIndex.append(i)
		vowels.reverse()
		vowelsString = ''.join(vowels)
		for i in range(len(vowelsString)):
			newList[noIndex[i]] = vowels[i]
		return ''.join(newList)


class Solution:

	def modify(self, s):
		ls = list(s)
		left_p = 0
		right_p = len(ls) - 1
		while left_p < right_p:
			if ls[left_p] in 'aeiou' and ls[right_p] in 'aeiou':
				(ls[left_p], ls[right_p]) = (ls[right_p], ls[left_p])
				left_p = left_p + 1
				right_p = right_p - 1
			elif ls[left_p] not in 'aeiou' and ls[right_p] in 'aeiou':
				left_p = left_p + 1
			elif ls[left_p] in 'aeiou' and ls[right_p] not in 'aeiou':
				right_p = right_p - 1
			else:
				left_p = left_p + 1
				right_p = right_p - 1
		return ''.join(ls)


class Solution:

	def modify(self, s):
		l = []
		for i in s:
			if i == 'a' or i == 'e' or i == 'o' or (i == 'i') or (i == 'u'):
				l.append(i)
		l = l[::-1]
		res = ''
		count = 0
		for i in range(len(s)):
			if s[i] == 'a' or s[i] == 'e' or s[i] == 'o' or (s[i] == 'i') or (s[i] == 'u'):
				res += l[count]
				count += 1
			else:
				res += s[i]
		return res


class Solution:

	def modify(self, s):
		S = ''
		S1 = ''
		a = -1
		for i in s:
			if i in 'aeiou':
				S += i
		for i in range(0, len(s)):
			if s[i] in 'aeiou':
				S1 += S[a]
				a -= 1
			else:
				S1 += s[i]
		return S1


class Solution:

	def modify(self, s):
		a = ['a', 'e', 'i', 'o', 'u']
		letter = ''
		s = list(s)
		i = 0
		j = len(s) - 1
		while i < j:
			if s[i] in a and s[j] in a:
				(s[i], s[j]) = (s[j], s[i])
				i += 1
				j -= 1
			elif s[i] not in a:
				i += 1
			elif s[j] not in a:
				j -= 1
		for i in s:
			letter += i
		return letter


class Solution:

	def modify(self, s):
		vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'])
		s = list(s)
		(i, j) = (0, len(s) - 1)
		while i < j:
			if s[i] in vowels and s[j] in vowels:
				(s[i], s[j]) = (s[j], s[i])
				i += 1
				j -= 1
			elif s[i] in vowels:
				j -= 1
			elif s[j] in vowels:
				i += 1
			else:
				i += 1
				j -= 1
		p = ''.join(s)
		return p


class Solution:

	def modify(self, s):
		k = 'aieouAIEOUS'
		st = ''
		for i in range(len(s)):
			if s[i] in k:
				st = st + s[i]
		if st != '':
			st = st[::-1]
			q = 0
			for i in range(len(s)):
				if s[i] in k:
					s = s[:i] + st[q] + s[i + 1:]
					q = q + 1
			return s
		else:
			return s


class Solution:

	def modify(self, s):
		vowel = ''
		for i in s:
			if i in set('aeiou'):
				vowel += i
		global rev_vowel
		rev_vowel = vowel[::-1]
		global ans
		ans = ''
		for i in s:
			if i not in set('aeiou'):
				ans = ans + i
			else:
				i = 0
				ans = ans + rev_vowel[i]
				i = i + 1
				rev_vowel = rev_vowel[i::1]
		else:
			return ans


class Solution:

	def modify(self, s):
		vowels = ['a', 'e', 'i', 'o', 'u']
		stack = []
		for i in s:
			if i in vowels:
				stack.append(i)
		result = ''
		for i in range(len(s)):
			if s[i] in vowels:
				result += stack.pop()
			else:
				result += s[i]
		return result


class Solution:

	def modify(self, s):
		v = ['a', 'e', 'i', 'o', 'u']
		stack = []
		for i in s:
			if i in v:
				stack.append(i)
		ans = ''
		for i in range(len(s)):
			if s[i] in v:
				ans += stack.pop()
			else:
				ans += s[i]
		return ans


class Solution:

	def modify(self, s):
		vowel = 'aeiou'
		li = []
		str1 = ''
		for i in s:
			if i in vowel:
				li.append(i)
		li.reverse()
		j = 0
		for i in s:
			if i in vowel:
				str1 = str1 + li[j]
				j = j + 1
			else:
				str1 = str1 + i
		return str1


class Solution:

	def modify(self, s):
		lst = []
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		for i in s:
			if i in v:
				lst.append(i)
		str = ''
		for i in s:
			if i in v:
				str += lst[-1]
				lst.pop(-1)
			else:
				str += i
		return str


class Solution:

	def modify(self, s):
		res = []
		for i in s:
			res.append(i)
		i = 0
		j = len(s) - 1
		dict = {'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0}
		while i <= j:
			while i < j and res[i].lower() not in dict:
				i += 1
			while j > i and res[j].lower() not in dict:
				j -= 1
			if i == j:
				break
			(res[i], res[j]) = (res[j], res[i])
			i += 1
			j -= 1
		return ''.join(res)