summaryrefslogtreecommitdiff
path: root/comp/work/43/q1.py
blob: acd5f93e9482002f566ca7676b01b2d8c8ce600e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def isvowel(char):
        if char in "aeoiu":
                return True;
        return False

def tolist(string):
        list = []
        for i in string:
        	list.append(i)
       	return list
	
def stripvowels(string):
        out = ""
        vowels = ""
        for i in string:
                if isvowel(i):
                        out += "."
                        vowels += i
                else:
                        out += i

        vowels = tolist(reversed(vowels))
        return out, vowels

def swap(string, vowels):
        final = ""
        for i in string:
                if i == ".":
                        final += vowels.pop(0)
                else:
                        final += i
        return final


string = input("input a string: ")

string, vowels = stripvowels(string)
print(swap(string, vowels))