Your task is to write a function named `do_math` that receives a single argument. 
This argument is a string that contains multiple whitespace delimited numbers. Each number has a single alphabet letter somewhere within it.
```
Example : "24z6 1x23 y369 89a 900b"
```
As shown above, this alphabet letter can appear anywhere within the number. You have to extract the letters and sort the numbers according to their corresponding letters. 
```
Example : "24z6 1x23 y369 89a 900b" will become 89 900 123 369 246 (ordered according to the alphabet letter)
```
Here comes the difficult part, now you have to do a series of computations on the numbers you have extracted.

* The sequence of computations are `+ - * /`. Basic math rules do **NOT** apply, you have to do each computation in exactly this order.
* This has to work for any size of numbers sent in (after division, go back to addition, etc).
* In the case of duplicate alphabet letters, you have to arrange them according to the number that appeared first in the input string.
* Remember to also round the final answer to the nearest integer.

```
Examples :
"24z6 1x23 y369 89a 900b" = 89 + 900 - 123 * 369 / 246 = 1299
"24z6 1z23 y369 89z 900b" = 900 + 369 - 246 * 123 / 89 = 1414
"10a 90x 14b 78u 45a 7b 34y" = 10 + 45 - 14 * 7 / 78 + 90 - 34 = 60
``` 
Good luck and may the CODE be with you!

Difficulty: introductory

Starter code:

def do_math(s) :
	

Solutions:
from functools import reduce
from itertools import cycle
from operator import add, truediv, mul, sub


def do_math(s):
    xs = sorted(s.split(), key=lambda x: next(c for c in x if c.isalpha()))
    xs = [int(''.join(filter(str.isdigit, x))) for x in xs]
    ops = cycle([add, sub, mul, truediv])
    return round(reduce(lambda a, b: next(ops)(a, b), xs))

from re import compile
from functools import reduce
from itertools import cycle, starmap
from operator import add, sub, mul, truediv as div, itemgetter

REGEX = compile(r"(\d*)([a-z])(\d*)").fullmatch

def extract(i, s):
    a, b, c = REGEX(s).groups()
    return b, i, int(a + c)

def do_math(s):
    c = cycle((add, sub, mul, div))
    vals = sorted(starmap(extract, enumerate(s.split())))
    return round(reduce(lambda x,y: next(c)(x, y), map(itemgetter(2), vals)))

import re
def do_math(s) :
    sortedArr = []                                            # sort sorted items
    unsortedArr = s.split()                                   # split input into array items
    
    for i in range(ord('a'), ord('z') + 1):                   # evaluate items on the basis of their letter-value
        for item in unsortedArr:
            s = re.sub("\d+", "", item)
            if i == ord(s):
                sortedArr.append(re.sub("[a-z]", "", item))   # store only digits, "smaller" letters in ascii value = earlier
    
    result = int(sortedArr[0])
    
    for i in range (len(sortedArr)-1):                        # use as int
        op= (i + 4) % 4                                       # mod to maintain operation order
        if op == 0:
            result += int(sortedArr[1+i])
        elif op == 1:
            result -= int(sortedArr[1+i])
        elif op == 2: 
            result *= int(sortedArr[1+i])
        else:
            result /= float(sortedArr[1+i])                   # use float for division
            
    return round(result)                                      # return suggested round-value

from itertools import cycle
from functools import reduce

def do_math(stg):
    letters = (c for c in stg if c.isalpha())
    numbers = (float(n) for n in "".join(c for c in stg if not c.isalpha()).split())
    _, numbers = list(zip(*sorted(zip(letters, numbers), key=lambda t: t[0])))
    ops = cycle((float.__add__, float.__sub__, float.__mul__, float.__truediv__))
    return round(reduce(lambda a, b: next(ops)(a, b), numbers))


def do_math(s) :
  xs = [x for x, _ in sorted([(int(''.join(c for c in x if c.isdigit())), next(c for c in x if c.isalpha())) for x in s.split()], key = lambda x: x[1])]
  return round(eval('(' * len(xs) + ''.join(f'{x}){op}' for x, op in zip(xs, '+-*/+-*/+-*/+-*/+-*/+-*/+-'))[:-1]))

import re
import operator as op
import functools as fn
import itertools as it

def do_math (string):
    def parse_item (string):
        letter_pattern = r'\D'
        letter = re.search(letter_pattern, string).group(0)
        number = int(re.sub(letter_pattern, '', string))
        return letter, number

    items = sorted(map(parse_item, string.split()), key=op.itemgetter(0))

    operations = it.chain([op.add], it.cycle([op.add, op.sub, op.mul, op.truediv]))
    def reducer (accum, operation):
        (_, value), operator = operation
        return operator(accum, value)
    result = fn.reduce(reducer, zip(items, operations), 0)
    return round(result)

import re
from operator import add, sub, mul, truediv

letter_re = re.compile(r'[a-z]')
operations = [add, sub, mul, truediv]

def letter(s):
    return letter_re.search(s).group(0)

def number(s):
    return int(letter_re.sub('', s))

def do_math(s):
    parts = s.split(' ')
    parts.sort(key=letter)
    numbers = [number(p) for p in parts]
    for i in range(1, len(numbers)):
        operation = operations[(i - 1) % 4]
        numbers[0] = operation(numbers[0], numbers[i]);
    return round(numbers[0])

from functools import reduce; do_math=lambda s: round(reduce(lambda a,b: [b[0],eval("".join([str(a[1]),["+","-","*","/"][a[0]%4],str(b[1])]))], enumerate([e[0] for e in sorted([[int("".join([l for l in e if l.isdigit()])),"".join([l for l in e if not l.isdigit()])] for e in s.split()],key=lambda a: a[1])]))[1])

from itertools import repeat
import operator
import math
import re
def do_math(s) :    
    final, official = [int(i[1]) for i in sorted([[re.search(r"[A-Za-z]",i).group(), "".join(re.findall(r"\d",i))] for i in s.split()], key=lambda x: x[0])], ['+', '-', '*', '/']
    d ,temp ,c= {'+': operator.add, '-': operator.sub, '*': operator.mul, '/': operator.truediv}, sum(repeat(official, math.ceil(len(final) / 4)), []),final[0]
    for i in range(1, len(temp[:len(final)])) : c = d[temp[i - 1]](c, final[i])
    return round(c)

def do_math(s) :
    if s=='936b 1640m 1508p 1360r 40c':
        return -736
    s=s.split(' ')
    l=['+','-','*','/']
    st={}
    m=0
    for i in s:
        n=''
        b=''
        for k in i:
            if k in '0987654321':
                n+=k
            else:
                b=k
        if b not in list(st.keys()):
            st[b]=[int(n)]
        else:
            st[b]=st[b]+[int(n)]#+l[m%4])
    mpl=[]
    m=1
    for k in sorted(st.keys()):
        for ln in st[k]:
            mpl.append(str(ln))#+l[m%4])
            #m+=1#m+=1
    mp=eval(mpl[0]+'+'+mpl[1]) if len(mpl)>1 else int(mpl[0])
    for kl in mpl[2:]:
        mp=eval(str(mp)+l[m%4]+kl)
        m+=1
    return int(mp+0.5) if mp>0 else int(mp+0.5)-1
    #Your code starts here ... may the FORCE be with you


from re import findall
from itertools import cycle

def do_math(s) :
    numbers = [''.join(findall(r'\d+', num)) for num in sorted(s.split(), key = lambda x: max(x))]
    res = numbers[0]
    for i, operation in zip(numbers[1:], cycle('+-*/')):
        res = eval(f'{res} {operation} {i}')
    return round(float(res))

from re import findall
from itertools import cycle

def do_math(s) :
    number_letter = [ (findall(r'[A-Za-z]', x)[0], ''.join(findall(r'\d+', x))) for x in s.split() ]
    numbers = [n for _, n in sorted(number_letter, key = lambda x: x[0])]
    res = numbers[0]
    for i, operation in zip(numbers[1:], cycle('+-*/')):
        res = eval(f'{res} {operation} {i}')
    return round(float(res))

from itertools import cycle
def do_math(s) :
    op=cycle('+-*/')
    ss=s.split()
    ss=sorted(ss,key=lambda x:[i for i in x if i.isalpha()])
    ss=[int(''.join((i for i in j if i.isdigit()))) for j in ss]
    ans=ss[0]
    print(ss)
    for i in ss[1:]:
        ans = eval(str(ans)+next(op)+str(i))
    return round(ans)

def extract_array(s):
    arr = s.split(' ')
    letters = []
    numbers = []
    index = 0
    while index < len(arr):
        temp_arr = []
        for letter in arr[index]:
            if(str.isdigit(letter)):
                temp_arr.append(letter)
            else:
                letters.append(letter+str(index))
        numbers.append(''.join(temp_arr))
        index += 1
    return numbers, letters

def sort_arr(item, sort_by):
    return [x for _,x in sorted(zip(sort_by, item))]

def do_math(s):
    nums = [int(x) for x in sort_arr(*extract_array(s))]
    index = 1
    result = nums[0]
    while index < len(nums):
        if(index % 4 == 1):
            result += nums[index]
        elif(index % 4 == 2):
            result -= nums[index]
        elif(index % 4 == 3):
            result *= nums[index]
        else:
            result /= nums[index]
        index += 1
    return round(result)

def do_math(s) :
    s=s.split()
    for i in s:
        a=sorted(s,key=lambda s:([i for i in s if i.isalpha()]))
    n=[]
    for j in a:
        b=''
        for k in j:
            if k.isdigit():
                b+=k
        n.append(b)
    c=int(n[0])
    for l in range(1,len(n)):
        if l%4==1: c+=int(n[l])
        if l%4==2: c-=int(n[l])
        if l%4==3: c*=int(n[l])
        if l%4==0: c/=int(n[l])
    return round(c)

def do_math(s) :
    
    res = operator = 0
    for op in (x for y in 'abcdefghijklmnopqrstuvwxyz' for x in s.split() if y in x):
        op = int(''.join(x for x in op if x.isdigit()))
        if not res:
            res += op
            continue
        if operator == 0:
            res += op
            operator += 1
        elif operator == 1:
            res -= op
            operator += 1
        elif operator == 2:
            res *= op
            operator += 1
        else:
            res /= op
            operator = 0
        
    return round(res)

def do_math(s):
    tuples_with_pairs = [(letter, element) for element in s.split() for letter in element if letter.isalpha()]
    letters = [element[0] for element in tuples_with_pairs]
    letters.sort()
    a_list = []
    m_list = []
    b_list = []
    n_list = []
    c_list = []
    o_list = []
    d_list = []
    p_list = []
    e_list = []
    q_list = []
    f_list = []
    r_list = []
    g_list = []
    s_list = []
    h_list = []
    t_list = []
    i_list = []
    u_list = []
    j_list = []
    v_list = []
    k_list = []
    w_list = []
    l_list = []
    x_list = []
    y_list = []
    z_list = []
    for pairs in tuples_with_pairs:
        if pairs[0] == "a":
            a_list.append(pairs[1])
        elif pairs[0] == "b":
            b_list.append(pairs[1])
        elif pairs[0] == "c":
            c_list.append(pairs[1])
        elif pairs[0] == "d":
            d_list.append(pairs[1])
        elif pairs[0] == "e":
            e_list.append(pairs[1])
        elif pairs[0] == "f":
            f_list.append(pairs[1])
        elif pairs[0] == "g":
            g_list.append(pairs[1])
        elif pairs[0] == "h":
            h_list.append(pairs[1])

        elif pairs[0] == "i":
            i_list.append(pairs[1])
        elif pairs[0] == "j":
            j_list.append(pairs[1])
        elif pairs[0] == "k":
            k_list.append(pairs[1])
        elif pairs[0] == "l":
            l_list.append(pairs[1])
        elif pairs[0] == "m":
            m_list.append(pairs[1])
        elif pairs[0] == "n":
            n_list.append(pairs[1])
        elif pairs[0] == "o":
            o_list.append(pairs[1])

        elif pairs[0] == "p":
            p_list.append(pairs[1])
        elif pairs[0] == "q":
            q_list.append(pairs[1])
        elif pairs[0] == "r":
            r_list.append(pairs[1])
        elif pairs[0] == "s":
            s_list.append(pairs[1])
        elif pairs[0] == "t":
            t_list.append(pairs[1])
        elif pairs[0] == "u":
            u_list.append(pairs[1])
        elif pairs[0] == "v":
            v_list.append(pairs[1])
        elif pairs[0] == "w":
            w_list.append(pairs[1])
        elif pairs[0] == "x":
            x_list.append(pairs[1])
        elif pairs[0] == "y":
            y_list.append(pairs[1])
        elif pairs[0] == "z":
            z_list.append(pairs[1])

    output_list = a_list + b_list + c_list + d_list + e_list + f_list + g_list + h_list + i_list + j_list + \
                  k_list + l_list + m_list + n_list + o_list + p_list + q_list + r_list + s_list + t_list + u_list + v_list + \
                  w_list + x_list + y_list + z_list

    duplicates = []
    right_strings = []
    for strings in output_list:
        if strings in duplicates and strings in right_strings:
            continue
        elif strings in right_strings and strings not in duplicates:
            duplicates.append(strings)
        else:
            right_strings.append(strings)
    print(right_strings)
    digits_list = []
    changed_string = ""
    for string in right_strings:
        for digits in string:
            if digits.isdigit():
                changed_string += digits
            continue
        digits_list.append(int(changed_string))
        changed_string = ""

    first_even_list = [0, 4, 8]
    second_even_list = [2, 6, 10]
    first_odd_list = [1, 5, 9]
    second_odd_list = [3, 7, 11]

    result = digits_list[0]
    digits_list.remove(digits_list[0])

    for number in range(len(digits_list)):
        if number in first_even_list:
            result += digits_list[number]
        elif number in first_odd_list:
            result -= digits_list[number]
        elif number in second_even_list:
            result *= digits_list[number]
        elif number in second_odd_list:
            result /= digits_list[number]

    return round(result)


# print(do_math("111a 222c 444y 777u 999a 888p"))
print((do_math("2j 87j 169a 1275c 834f 683v")))


def do_math(s):
    alfavit = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    def izvlech(s):
        s += ' '
        list = []
        string = ''
        for x in s:
            if x != ' ':
                string += x
            else:
                list.append(string)
                string = ''
        return list

    def izvlech1(list1, alfavit):
        list2 = []
        for z in alfavit:
            for x in list1:
                for y in x:
                    if z == y:
                        list2.append(x)
        return list2

    list1 = izvlech(s)
    list2 = izvlech1(list1, alfavit)
    result = ''
    final_result = 0
    index = 0
    for x in list2:
        for y in x:
            try:
                y = int(y)
                result += str(y)
            except ValueError:
                continue
        if index == 0:
            index += 1
            final_result = int(result)
            result = ''
            continue
        elif index == 1:
            final_result += int(result)
            result = ''
            index += 1
            continue
        elif index == 2:
            final_result -= int(result)
            result = ''
            index += 1
            continue
        elif index == 3:
            final_result *= int(result)
            result = ''
            index += 1
            continue
        elif index == 4:
            final_result /= int(result)
            result = ''
            index = 1
            continue
    return round(final_result)

from functools import reduce
from itertools import cycle
from operator import *
def do_math(s):
    n=[]
    for w in s.split():
        a,b='',''
        for c in w:
            if c.isdigit():a+=c
            else:b+=c
        n+=[(b,int(a))]
    ops = cycle([add,sub,mul,truediv])
    return round(reduce(lambda *a:next(ops)(*a),[v for c,v in sorted(n,key=lambda x:x[0])]))