**Step 1:** Create a function called `encode()` to replace all the lowercase vowels in a given string with numbers according to the following pattern:
```
a -> 1
e -> 2
i -> 3
o -> 4
u -> 5
```

For example, `encode("hello")` would return `"h2ll4"`. There is no need to worry about uppercase vowels in this kata.

**Step 2:** Now create a function called `decode()` to turn the numbers back into vowels according to the same pattern shown above.

For example, `decode("h3 th2r2")` would return `"hi there"`.

For the sake of simplicity, you can assume that any numbers passed into the function will correspond to vowels.

Difficulty: introductory

Starter code:

def encode(st):
	

Solutions:
def encode(s, t=str.maketrans("aeiou", "12345")):
    return s.translate(t)
    
def decode(s, t=str.maketrans("12345", "aeiou")):
    return s.translate(t)

CIPHER = ("aeiou", "12345")

def encode(st):
    return st.translate(str.maketrans(CIPHER[0], CIPHER[1]))
    
def decode(st):
    return  st.translate(str.maketrans(CIPHER[1], CIPHER[0]))

def encode(st):
    for i, v in enumerate("aeiou", start=1):
        st = st.replace(v,str(i))
    return st
    
def decode(st):
    for i, v in enumerate("aeiou", start=1):
        st = st.replace(str(i),v)
    return st

tbl1 = str.maketrans("aeiou", "12345")
tbl2 = str.maketrans("12345", "aeiou")


def encode(st):
    return st.translate(tbl1)


def decode(st):
    return st.translate(tbl2)

a={'a':'1','e':'2','i':'3','o':'4','u':'5'}
b=('a','e','i','o','u')
def encode(st):
    return "".join(a[c] if c in a else c for c in st)
    
def decode(st):
    return "".join(b[int(c)-1] if c.isdigit() else c for c in st)

def cipher(mode):
    table = str.maketrans(*['aeiou', '12345'][::mode])
    return lambda s: s.translate(table)

encode, decode = cipher(1), cipher(-1)

CYPHER = tuple(zip('aeiou', '12345'))

def munge(st, mapping):
    return ''.join([mapping.get(c, c) for c in st])

def encode(st):
    return munge(st, {a: b for a, b in CYPHER})
    
def decode(st):
    return munge(st, {b: a for a, b in CYPHER})


def encode(st):
    L=[]
    A = {"a":"1","e":"2","i":"3","o":"4","u":"5"}
    for i in st:
        if i in A:
            L.append(A[i])
        else:
            L.append(i)
    return "".join(L)
    
def decode(st):
    L=[]
    A = {"1":"a","2":"e","3":"i","4":"o","5":"u"}
    for i in st:
        if i in A:
            L.append(A[i])
        else:
            L.append(i)
    return "".join(L)

import re
def encode(st):
    vowel = ' aeiou'
    return re.sub(r'[aeoui]', lambda x: str(vowel.index(x.group(0))) ,st)
    
def decode(st):
    vowel = ' aeiou'
    return re.sub(r'[1-5]', lambda x: vowel[int(x.group(0))] ,st)


a = ["a","e","i","o","u"]
def encode(st):
    return "".join([str(a.index(c) + 1) if c in a else c for c in st])
def decode(st):
    return "".join([a[int(c)-1] if c.isdigit() else c for c in st])