Consider the following expansion:
```Haskell
solve("3(ab)") = "ababab" -- "ab" repeats 3 times
solve("2(a3(b))" = "abbbabbb" -- "a3(b)" == "abbb" repeats twice.
```

Given a string, return the expansion of that string. 

Input will consist of only lowercase letters and numbers (1 to 9) in valid parenthesis. There will be no letters or numbers after the last closing parenthesis.

More examples in test cases. 

Good luck!

Please also try [Simple time difference](https://www.codewars.com/kata/5b76a34ff71e5de9db0000f2)

Difficulty: introductory

Starter code:

def solve(st):
	

Solutions:
def solve(s):
    s1 = s[::-1]
    s2 = ''
    for i in s1:
        if i.isalpha():
            s2 += i
        elif i.isdigit():
            s2 = s2*int(i)
    return s2[::-1]

import re

def solve(s):
    ops, parts = [], ['']
    for c in re.findall(r'\d*\(|\)|[a-z]+', s):
        if c == ')':
            segment = parts.pop()
            parts[-1] += ops.pop()*segment
        elif not c[0].isalpha():
            ops.append(int(c[:-1]) if c[0] != '(' else 1)
            parts.append('')
        else:
            parts[-1] += c
    return parts[0]

import re

def solve(st):
    matches = re.match("([a-z]*)(\d*)\((.*)\)", st)
    if not matches:
        return st
    return matches.group(1) + (int(matches.group(2)) if matches.group(2) else 1) * solve(matches.group(3))

import re

def solve(s):
    return solve(re.sub(r'(\d*)\(([a-zA-Z]*)\)', lambda m: m.group(2) * (1 if m.group(1) == "" else int(m.group(1))), s)) if re.search(r'(\d*)\(([a-zA-Z]*)\)', s) != None else s

def solve(s):
    while '(' in s:
        l, r = s.rsplit('(', 1)
        ss, r = r.split(')', 1)
        s = (l[:-1] + ss * int(l[-1]) + r ) if l[-1].isdigit() else l + ss + r
    return s


def solve(st):
    tempstr = ""
    for i in reversed(st):
        if i.isalpha():
            tempstr += i
        if i.isdigit():
            tempstr = tempstr * int(i)
    return tempstr[::-1]

def solve(st):
    strx = ''
    for i,x in enumerate(st):
        if x.isdigit():
            return strx + int(x)*solve(st[i+1:])
        if x.isalpha():
            strx += x
    return strx

def solve(a):
    sta, exp = '', ''
    for i in a[::-1]:
        if i.isalnum() or i == '(':
            if i == '(':
                exp += sta
                sta = ''
            elif ord(i) in range(48, 58): exp = exp*int(i)
            else: sta += i
    return exp[::-1] if a[0].isnumeric() else a[0]+exp[::-1]

def solve(st):
    st = st.replace('(','').replace(')','')
    i  = len(st)
    while i:
        i -=1
        if st[i].isdigit():
            dg = int(st[i])
            ex = st[i+1:] * dg
            st = st[:i] + ex
            i += dg
    return st
        


from re import sub

def solve(st):
    while True:
        st, tmp = sub("(\d)*\((\w+)\)", lambda s: s.group(2)*int(s.group(1) or 1), st), st
        if st == tmp: return st