Given string str, transform it according to the following rules:
Delete all the vowels from the string.
Insert # in front of all the consonants.
Change the case of all the letters of the string. 
Example 1:
Input:
str = aBAcAba
Output: #b#C#B
Explanation: Vowels at position 0,2,4,6 are deleted.
'#' is added before consonants at position 1,3,5 
and their case is changed.
Your Task:  
You don't need to read input or print anything. Complete the function transform() which takes the string str as an input parameter and returns the transformed string. If the resulting string is empty return "-1".
Expected Time Complexity: O(N) where N is the length of str.
Expected Auxiliary Space: O(N)  
Constraints:
1<= str.length() <= 10^{4}

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3

class Solution:

    def transform(self, Str):
        # code here
    

Solutions:
class Solution:

	def transform(self, s):
		t = ''
		p = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'}
		for i in s:
			if i not in p:
				t += '#'
				if i.islower():
					t += i.upper()
				else:
					t += i.lower()
		if len(t):
			return t
		return -1


class Solution:

	def transform(self, Str):
		for vowel in 'AaEeIiOoUu':
			if vowel in Str:
				Str = Str.replace(vowel, '')
		res = ''
		for ch in Str:
			res += '#' + ch
		return res.swapcase() if res else '-1'


class Solution:

	def transform(self, Str):
		str1 = ''
		for i in Str:
			if i not in 'aeiouAEIOU':
				str1 += '#' + i.swapcase()
		if str1 == '':
			return -1
		return str1


class Solution:

	def transform(self, s):
		output = ''
		vowels = set('aeiouAEIOU')
		for item in s:
			if item in vowels:
				continue
			output += '#'
			if item.isupper():
				output += item.lower()
			else:
				output += item.upper()
		return output if output else -1


class Solution:

	def transform(self, Str):
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		lst = list(Str)
		for i in range(len(lst)):
			if lst[i] in v:
				lst[i] = ''
			else:
				lst[i] = '#' + lst[i].swapcase()
		ans = ''.join(lst)
		if ans == '':
			ans = -1
		return ans


class Solution:

	def transform(self, s):
		a = 'aeiouAEIOU'
		r = ''
		for i in s:
			if i not in a:
				r += i
		if len(r) == 0:
			return -1
		m = ''
		for i in range(len(r)):
			if r[i].islower():
				x = r[i].upper()
				m += '#' + x
			else:
				x = r[i].lower()
				m += '#' + x
		return m


import re

class Solution:

	def transform(self, Str):
		temp = ''
		s = 'aeiouAEIOU'
		if re.search(Str, s):
			return -1
		for i in Str:
			if i in s:
				continue
			elif i.isupper():
				temp += '#' + i.lower()
			else:
				temp += '#' + i.upper()
		return temp


class Solution:

	def transform(self, Str):
		vo = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		res = ''
		for i in Str:
			if i in vo:
				continue
			elif i not in vo:
				if i.islower() == True:
					res += '#' + i.upper()
				else:
					res += '#' + i.lower()
		if len(res) == 0:
			return -1
		else:
			return res


class Solution:

	def transform(self, Str):
		ans = ''
		v = ['a', 'e', 'i', 'o', 'u']
		vv = ['A', 'E', 'I', 'O', 'U']
		for i in Str:
			if i not in v and i not in vv:
				ans += '#'
				if i.islower():
					ans += i.upper()
				else:
					ans += i.lower()
		if not ans:
			return -1
		return ans


class Solution:

	def transform(self, Str):
		vowels = 'AaEeIiOoUu'
		for i in vowels:
			if i in Str:
				Str = Str.replace(i, '')
		res = ''
		for i in Str:
			res += '#' + i
		return res.swapcase() if res else -1


class Solution:

	def transform(self, Str):
		Vowels = 'aeiou'
		Ans = ''
		for i in Str:
			if i.lower() not in Vowels:
				Ans += '#' + i.swapcase()
		return Ans if Ans != '' else -1


class Solution:

	def transform(self, Str):
		voe = 'AUIOEauioe'
		out = ''
		s = Str
		for i in voe:
			if i in s:
				s = s.replace(i, '')
		if len(s) == 0:
			return -1
		for ch in s:
			out += '#' + ch
		return out.swapcase()


class Solution:

	def transform(self, Str):
		res = ''
		for x in Str:
			if x not in 'aeiouAEIOU':
				res += '#' + x
		return res.swapcase() if res else -1


class Solution:

	def transform(self, Str):
		res = ''
		for x in Str:
			if x not in 'aeiouAEIOU':
				res += '#'
				if x.isupper():
					res += x.lower()
				else:
					res += x.upper()
		if not res:
			return -1
		return res


class Solution:

	def transform(self, Str):
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		sl = []
		sl1 = []
		for i in Str:
			sl.append(i)
		st = ''
		for i in sl:
			if i not in v:
				st += i
		if len(st) == 0:
			return '-1'
		for i in st:
			sl1.append(i)
		ans = ''
		for i in sl1:
			ans += i.swapcase()
		res = '#'
		for i in range(0, len(ans) - 1):
			res += ans[i] + '#'
		res += ans[len(ans) - 1]
		return res


class Solution:

	def transform(self, s):
		h = ''
		r = ''
		for i in s:
			if i not in 'aeiouAEIOU':
				r += i
		if len(r) == 0:
			return -1
		r = r.swapcase()
		for i in r:
			h += '#' + i
		return h


class Solution:

	def transform(self, Str):
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		d = ''
		for i in Str:
			if i not in v and i.isupper():
				d += '#' + i.lower()
			if i not in v and i.islower():
				d += '#' + i.upper()
		if len(d) > 1:
			return d
		else:
			return -1


class Solution:

	def transform(self, Str):
		for i in 'AaEeIiOoUu':
			if i in Str:
				Str = Str.replace(i, '')
		l = ''
		for i in Str:
			l += '#' + i
		return l.swapcase() if l else '-1'


class Solution:

	def transform(self, Str):
		for i in 'aeiouAEIOU':
			if i in Str:
				Str = Str.replace(i, '')
		r = ''
		for i in Str:
			r += '#' + i
		if r:
			return r.swapcase()
		else:
			return '-1'


class Solution:

	def transform(self, Str):
		t = ''
		h = []
		for i in Str:
			if i in 'aeiouAEIOU':
				pass
			else:
				t += i
		if len(t) == 0:
			return '-1'
		t = t.swapcase()
		for i in t:
			h.append('#' + i)
		return ''.join(map(str, h))


class Solution:

	def transform(self, Str):
		myans = []
		vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		for i in Str:
			if i not in vowels:
				myans.append('#')
				if i.isupper():
					myans.append(i.lower())
				else:
					myans.append(i.upper())
		if len(myans) == 0:
			return -1
		return ''.join(myans)


class Solution:

	def transform(self, Str):
		s = {'a', 'A', 'e', 'E', 'I', 'i', 'o', 'O', 'u', 'U'}
		t = ''
		for i in Str:
			if i not in s:
				if i.isupper():
					t += '#' + i.lower()
				else:
					t += '#' + i.upper()
		if len(t) == 0:
			return '-1'
		return t


class Solution:

	def transform(self, Str):
		vowels = 'aeiouAEIOU'
		newstr = ''
		for i in Str:
			if i not in vowels:
				newstr += i
		newstr1 = ''
		for i in newstr:
			if i.isupper():
				newstr1 = newstr1 + '#' + i.lower()
			if i.islower():
				newstr1 = newstr1 + '#' + i.upper()
		if newstr1 == '':
			return -1
		return newstr1


class Solution:

	def transform(self, Str):
		vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		s = ''
		for i in Str:
			if i in vowels:
				Str.replace(i, '')
			else:
				s = s + '#' + i
		s = s.swapcase()
		if s:
			return s
		else:
			return -1


class Solution:

	def transform(self, Str):
		S = ''
		for i in Str:
			if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u') or (i == 'A') or (i == 'E') or (i == 'I') or (i == 'O') or (i == 'U'):
				Str.replace(i, '')
			else:
				S = S + '#' + i
		s3 = ''
		for i in S:
			if i.isupper():
				s3 = s3 + i.lower()
			else:
				s3 = s3 + i.upper()
		if s3:
			return s3
		else:
			return -1


class Solution:

	def transform(self, Str):
		vowels = 'AEIOUaeiou'
		s = ''
		for i in Str:
			if i not in vowels:
				s += i
		s1 = ''
		for i in s:
			s1 += '#' + i
		s2 = ''
		for i in s1:
			if i.isupper():
				s2 = s2 + i.lower()
			else:
				s2 = s2 + i.upper()
		if s2 == '':
			return -1
		return s2


class Solution:

	def transform(self, Str):
		ans = []
		vowels = 'aeiouAEIOU'
		for i in Str:
			if i not in vowels:
				ans.append('#')
				if i.isupper():
					ans.append(i.lower())
				else:
					ans.append(i.upper())
		if len(ans) == 0:
			return -1
		return ''.join(map(str, ans))


class Solution:

	def transform(self, Str):
		voewal = 'aeiouAIEOU'
		result = ''
		for i in Str:
			if i in voewal:
				result += ''
			elif i.islower():
				result += '#' + i.upper()
			else:
				result += '#' + i.lower()
		if len(result) == 0:
			return -1
		return result[:len(result)]


class Solution:

	def transform(self, Str):
		s = ''
		for x in Str:
			if x.lower() in ['a', 'e', 'i', 'o', 'u']:
				continue
			elif x.isupper():
				s += '#' + x.lower()
			else:
				s += '#' + x.upper()
		if len(s) < 1:
			return -1
		else:
			return s


class Solution:

	def transform(self, Str):
		m = 'aeiouAEIOU'
		p = ''
		for i in Str:
			if i not in m:
				p += i
		q = ''
		for i in p:
			q = q + '#' + i
		r = ''
		for i in q:
			if i.islower():
				r = r + i.upper()
			else:
				r = r + i.lower()
		if len(r) == 0:
			return -1
		else:
			return r


class Solution:

	def transform(self, Str):
		r1 = ''
		r2 = ''
		r3 = ''
		vowel = 'aeiouAEIOU'
		for i in Str:
			if i not in vowel:
				r1 += i
		for i in r1:
			r2 = r2 + '#' + i
		for i in r2:
			if i.isupper():
				r3 = r3 + i.lower()
			else:
				r3 = r3 + i.upper()
		if r3 == '':
			return -1
		return r3


class Solution:

	def transform(self, Str):
		st = ''
		for i in Str:
			if i in 'aeiouAEIOU':
				continue
			else:
				st += '#'
				if i.islower():
					st += i.upper()
				else:
					st += i.lower()
		if st == '':
			return -1
		return st


class Solution:

	def transform(self, Str):
		final = ''
		for ch in Str:
			if ch == 'A' or ch == 'a' or ch == 'E' or (ch == 'e') or (ch == 'I') or (ch == 'i') or (ch == 'O') or (ch == 'o') or (ch == 'U') or (ch == 'u'):
				continue
			else:
				b = ch.swapcase()
				final = final + '#' + b
		if len(final) == 0:
			return -1
		return final


class Solution:

	def transform(self, Str):
		self.Str = Str
		for i in Str:
			if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u') or (i == 'A') or (i == 'E') or (i == 'I') or (i == 'O') or (i == 'U'):
				Str = Str.replace(i, '')
		hashtrick = '#'
		for j in Str:
			hashtrick = hashtrick + j + '#'
		final_str = hashtrick[0:-1].swapcase()
		if len(final_str) == 0:
			return -1
		else:
			return final_str


class Solution:

	def transform(self, Str):
		a = 'AEIOUaeiou'
		j = ''
		for i in Str:
			if i not in a:
				if i.isupper():
					j += '#'
					j += i.lower()
				elif i.islower():
					j += '#'
					j += i.upper()
		if len(j) != 0:
			return j
		else:
			return -1


class Solution:

	def transform(self, s):
		l = [''] * len(s)
		v = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
		for i in range(len(Str)):
			if s[i] in v:
				pass
			elif s[i].islower():
				l[i] = s[i].upper()
			elif s[i].isupper():
				l[i] = s[i].lower()
		l = [x for x in l if x != '']
		if l == []:
			return -1
		s = '#'.join(l)
		s = '#' + s
		return s


class Solution:

	def transform(self, Str):
		sol = ''
		for i in Str:
			if i in 'aeiouAEIOU':
				sol += ''
			else:
				if i.isupper():
					sol += '#' + i.lower()
				if i.islower():
					sol += '#' + i.upper()
		if len(sol) > 0:
			return sol
		else:
			return -1