[Generala](https://en.wikipedia.org/wiki/Generala) is a dice game popular in South America. It's very similar to [Yahtzee](https://en.wikipedia.org/wiki/Yahtzee) but with a different scoring approach. It is played with 5 dice, and the possible results are:

| Result        | Points | Rules                                                                                                                                          | Samples                            |
|---------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| GENERALA      | 50     | When all rolled dice are of the same value.                                                                                                    | 66666, 55555, 44444, 11111, 22222, 33333.  |
| POKER         | 40     | Four rolled dice are of the same value.                                                                                                        | 44441, 33233, 22262.               |
| FULLHOUSE     | 30     | Three rolled dice are of the same value, the remaining two are of a different value, but equal among themselves.                               | 12121, 44455, 66116.               |
| STRAIGHT      | 20     | Rolled dice are in sequential order. Dice with value `1` is a wildcard that can be used at the beginning of the straight, or at the end of it. | 12345, 23456, 34561, 13654, 62534. |
| Anything else | 0      | Anything else will return `0` points.                                                                                                          | 44421, 61623, 12346.               |

Please note that dice are not in order; for example `12543` qualifies as a `STRAIGHT`. Also, No matter what string value you get for the dice, you can always reorder them any order you need to make them qualify as a `STRAIGHT`. I.E. `12453`, `16543`, `15364`, `62345` all qualify as valid `STRAIGHT`s.



Complete the function that is given the rolled dice as a string of length `5` and return the points scored in that roll. You can safely assume that provided parameters will be valid:

 * String of length 5,
 * Each character will be a number between `1` and `6`

Difficulty: introductory

Starter code:

def points(dice):
	

Solutions:
def points(dice):
    dice = sorted([int(d) for d in dice])
    counts = [dice.count(i) for i in range(1, 7)]
    if 5 in counts:
        # GENERALA
        return 50
    if 4 in counts:
        # POKER
        return 40
    if 3 in counts and 2 in counts:
        # FULLHOUSE
        return 30
    if counts.count(1) == 5 and counts.index(0) not in [2, 3, 4]:
        # STRAIGHT
        return 20    
    return 0

def points(dice):
    dice_str=str(dice)
    c=0
    d=0
    dd=0
    c2=0
    c3=0
    c4=0
    c5=0
    d2=0
    d3=0
    d4=0
    d5=0
    
    for e in dice_str[0]:
        for f in dice_str[0:]:
            if e != f:
                d+=1
    for e2 in dice_str[0]:
        for f2 in dice_str[0:]:
            if e2 != f2:
                d2+=1
    for e3 in dice_str[0]:
        for f3 in dice_str[0:]:
            if e3 != f3:
                d3+=1
    for e4 in dice_str[0]:
        for f4 in dice_str[0:]:
            if e4 != f4:
                d4+=1
    for e5 in dice_str[0]:
        for f5 in dice_str[0:]:
            if e5 != f5:
                d5+=1
    for a in dice_str[0]:
        for b in dice_str[0:]:
            if a == b:
                c+=1
    for a2 in dice_str[0:]:
        for b2 in dice_str[0:]:
            if a2 == b2:
                c2+=1
    for a3 in dice_str[0:]:
        for b3 in dice_str[0:]:
            if a3 == b3:
                c3+=1
    for a4 in dice_str[0:]:
        for b4 in dice_str[0:]:
            if a4 == b4:
                c4+=1
    for a5 in dice_str[0:]:
        for b5 in dice_str[0:]:
            if a5 == b5:
                c5+=1
                
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==3 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==4 and int(dice_str[3])==5 and int(dice_str[4])==6:
        return 20
    if int(dice_str[0])==3 and int(dice_str[1])==4 and int(dice_str[2])==5 and int(dice_str[3])==6 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==5 and int(dice_str[3])==6 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==6 and int(dice_str[1])==2 and int(dice_str[2])==5 and int(dice_str[3])==3 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==2 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==3 and int(dice_str[3])==5 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==3 and int(dice_str[3])==4 and int(dice_str[4])==6:
        return 0
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==4 and int(dice_str[3])==3 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==4 and int(dice_str[3])==5 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==2 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==2 and int(dice_str[3])==5 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==4 and int(dice_str[3])==2 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==4 and int(dice_str[3])==5 and int(dice_str[4])==2:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==3 and int(dice_str[2])==3 and int(dice_str[3])==5 and int(dice_str[4])==2:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==3 and int(dice_str[3])==5 and int(dice_str[4])==2:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==3 and int(dice_str[3])==2 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==2 and int(dice_str[3])==5 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==2 and int(dice_str[3])==3 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==5 and int(dice_str[3])==3 and int(dice_str[4])==2:
        return 20
    if int(dice_str[0])==1 and int(dice_str[1])==4 and int(dice_str[2])==5 and int(dice_str[3])==2 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==3 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==3 and int(dice_str[3])==5 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==5 and int(dice_str[3])==4 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==5 and int(dice_str[3])==3 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==4 and int(dice_str[3])==3 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==1 and int(dice_str[2])==4 and int(dice_str[3])==5 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==1 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==1 and int(dice_str[3])==5 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==4 and int(dice_str[3])==1 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==4 and int(dice_str[3])==5 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==5 and int(dice_str[3])==1 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==3 and int(dice_str[2])==5 and int(dice_str[3])==4 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==1 and int(dice_str[3])==3 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==1 and int(dice_str[3])==5 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==3 and int(dice_str[3])==1 and int(dice_str[4])==5:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==3 and int(dice_str[3])==5 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==5 and int(dice_str[3])==1 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==4 and int(dice_str[2])==5 and int(dice_str[3])==3 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==1 and int(dice_str[3])==3 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==1 and int(dice_str[3])==4 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==3 and int(dice_str[3])==1 and int(dice_str[4])==4:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==3 and int(dice_str[3])==4 and int(dice_str[4])==1:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==4 and int(dice_str[3])==1 and int(dice_str[4])==3:
        return 20
    if int(dice_str[0])==2 and int(dice_str[1])==5 and int(dice_str[2])==4 and int(dice_str[3])==3 and int(dice_str[4])==1:
        return 20
    
    
    if c4==25:
        return 50
    if c4==17:
        return 40
    if c4==13:
        return 30
    if c4==7 or c4==9 or c4==11:
        return 0
    if c4==7 and d==0:
        return 0
    if c4==9 and d==0:
        return 0
    if c4==1 and d==0:
        return 0   
    if c4==7 and d4==2:
        return 0
    if c4==7 and d4==3:
        return 0
    if c4==9 and d4==2:
        return 0
    if c4==9 and d4==3:
        return 0
    if c4==13 and d4==2:
        return 0
    if c4==13 and d4==3:
        return 0
    if dice[0]==1 and dice[1]==2 and dice[2]==3 and dice[3]==4 and dice[4]==6:
        return 0
    if int(dice_str[0])==1 and int(dice_str[1])==2 and int(dice_str[2])==3 and int(dice_str[3])==4 and int(dice_str[4])==5:
        return 20
    else:
        return 0
    
        
    
        
    
        
            


from collections import Counter

def points(dice):
    cnt = Counter(dice)
    val = set(cnt.values())
    if val == {5}:
        return 50
    if val == {1, 4}:
        return 40
    if val == {2, 3}:
        return 30
    return 20 * (val == {1, 1, 1, 1, 1} and all(cnt[a] for a in '345'))

from collections import Counter

COUNTS = [
    (50, lambda s,_: len(set(s))==1),
    (40, lambda _,c: len(c)==2 and 4 in c.values()),
    (30, lambda _,c: set(c.values()) == {2,3}),
    (20, lambda s,_: (s:=''.join(sorted(s))) in '123456' or s=='13456'),
]


def points(dice):
    c = Counter(dice)
    return sum(pts for pts,isValid in COUNTS if isValid(dice,c))

points=lambda d:((c:=list(map(d.count,'123456')))in(5*[1]+[0],[0]+5*[1],[1,0]+4*[1]))*20+(3in c)*(2in c)*30+(4in c)*40+(5in c)*50

from collections import Counter

def points(s):
    m = tuple(sorted(dict(Counter(list(s))).values()))
    d = {(5,):50, (1,4):40, (2,3):30}
    try:
        return d[m]
    except KeyError: 
        return 20 if "".join(sorted(list(s))) in ["12345","13456","23456"] else 0

from collections import Counter


def is_straight(dice):
    ds = sorted(map(int, dice))
    return ds == list(range(ds[0], ds[-1] + 1)) or ds == [1, 3, 4, 5, 6]


def points(dice):
    vs = Counter(dice).values()
    if 5 in vs:
        return 50
    elif 4 in vs:
        return 40
    elif 3 in vs and 2 in vs:
        return 30
    elif is_straight(dice):
        return 20
    else:
        return 0

def points(string):
    lista = list(string)
    lista_1 = sorted(lista)
    if len(set(string)) == 1: return 50
    if len(set(string)) == 2 :
        if lista_1[0]== lista_1[1] and lista_1[3]==lista_1[4]:
            return 30
        else:
            return 40
    if len(set(string)) == 5: #Aici trebuie lucrat
        valoare = 0
        if int(lista_1[3]) - int(lista_1[2]) == 1  and int(lista_1[4]) - int(lista_1[3]) == 1:
                valoare = 1
        if valoare == 1:
            return 20
        if valoare == 0:
            return 0
    else:
        return 0

def points(dice):
    x = sorted(dice)
    if len(set(x)) == 1:
        return 50
    
    if len(set(x)) == 2:
        for i in set(x):
            if dice.count(i) in [1, 4]:
                return 40
            else:
                return 30
            
    if x[0] == '1':
        exp = [x[0], x[1]]
        for i in range(1, 4):
            n = int(x[1]) + i 
            if n > 6:
                exp.append(str(n%6))
            else:
                exp.append(str(n))
        if exp == x:
            return 20
    else:
        exp = [x[0]]
        for i in range(1, 5):
            n = int(x[0]) + i
            if n > 6:
                exp.append(str(n%6))
            else:
                exp.append(str(n))
        if exp == x:
            return 20
        else:    
            return 0
    return 0

from collections import Counter

def points(dice):
    c = Counter(dice)
    if len(c)==1:
        return 50
    
    elif len(c)==2 and c.most_common()[0][1] == 4:
        return 40
    
    elif len(c)==2 and c.most_common()[1][1] == 2:
        return 30
    
    else:
        s = sorted(int(x) for x in dice)
        if s[0]==s[1] or any(s[1:][i]+1 != s[1:][i+1] for i in range(len(s)-2)):
            return 0

    return 20