# Task

You got a `scratch lottery`, you want to know how much money you win.

There are `6` sets of characters on the lottery. Each set of characters represents a chance to win. The text has a coating on it. When you buy the lottery ticket and then blow it off, you can see the text information below the coating.

Each set of characters contains three animal names and a number, like this: `"tiger tiger tiger 100"`. If the three animal names are the same, Congratulations, you won the prize. You will win the same bonus as the last number.

Given the `lottery`, returns the total amount of the bonus.

# Input/Output


`[input]` string array `lottery`

A string array that contains six sets of characters.

`[output]` an integer

the total amount of the bonus.

# Example

For 
```
lottery = [
"tiger tiger tiger 100",
"rabbit dragon snake 100",
"rat ox pig 1000",
"dog cock sheep 10",
"horse monkey rat 5",
"dog dog dog 1000"
]```

the output should be `1100`.

`"tiger tiger tiger 100"` win $100, and `"dog dog dog 1000"` win $1000. 

`100 + 1000 = 1100`

Difficulty: introductory

Starter code:

def scratch(lottery):
	

Solutions:
def scratch(lottery):
    return sum(int(n) for lot in lottery for a,b,c,n in [lot.split()] if a==b==c)

def scratch(lottery):
    return sum(int(i.split()[-1]) for i in lottery if len(set(i.split()))==2)

def scratch(l):
    c = 0
    for i in l:
        i = i.split()
        if i[0] == i[1] == i[2]:
            c += int(i[3])
    return c

import re
def scratch(lottery):
    return sum(int(i[1]) for i in re.findall(r'([A-Za-z]+ )\1\1([0-9]*)',"-".join(lottery)))

def scratch(lottery):
    result = 0
    for ticket in lottery:
        words = ticket.split()
        if words[0] == words[1] == words[2]:
            result += int(words[3])
    return result


def scratch(lottery):
    ans = 0
    for ticket in lottery:
        t = ticket.split()
        if t.count(t[0]) == 3:
            ans += int(t[3])
    return ans

def scratch(lottery):
    return sum(win(*line.split()) for line in lottery)

def win(a, b, c, d):
    return int(d) if a == b == c else 0

scratch=lambda l:sum(int(a[3])for a in(r.split()for r in l)if len({*a})<3)

def scratch(lottery):
    return sum(int(s.split()[-1]) for s in lottery if len(set(s.split()[:-1])) == 1)

def scratch(L):
    return sum(int(d)*(a==b==c) for x in L for a,b,c,d in [x.split()])

def scratch(L):
    z=0
    for x in L:
        a,b,c,d=x.split()
        z+=int(d)*(a==b==c)
    return z

def scratch(lottery):
    #your code here
    sum = 0

    for x in lottery:
        j = x.split()
        if j[0] == j[1] == j[2]:
            sum += int(j[3])
    return sum

def scratch(lottery):
    return sum([int(i.split()[-1]) for i in lottery if len(set(i.split()[:-1]))==1])

def scratch(lottery): ##
    return sum(int(n) for combi in lottery for a,b,c,n in [combi.split()]if a==b==c)

def scratch(lottery):
    return sum(int(combi.split()[-1]) for combi in lottery if combi.split()[0]==combi.split()[1]==combi.split()[2]) or 0

def scratch(lottery):
    r = 0
    for s in lottery:
        *a,b = s.split()
        if len(set(a))==1:
            r += int(b)
    return r

from re import sub

def scratch(lottery):
    return sum(int(sub(r"[^\d]","",ch)) for ch in lottery if len(set(ch.split())) == 2)

def scratch(lottery):
    s=0
    for set in lottery:
        a,b,c,d=set.split()
        if a==b==c:s+=int(d)
    return s

def scratch(lottery):
    return sum(int(i.split()[3]) for i in lottery if i.split()[0] == i.split()[1] == i.split()[2])

def scratch(lottery):

    c = 0
    
    for i in range(0,len(lottery)):
        
        lo = lottery[i].split()
        
        print(lo)
        
        if all(x == lo[0] for x in lo[0:-1]):
            
            c+= int(lo[-1])
            
    return c