/gopinathanp

/enloe intermeediate python

 

 

 

for i in range(5):

    dataz = raw_input("Input: ")

    trump = dataz[0]

    dataz = dataz[2:]

    bling = []

    i = 0

    while dataz[i] != ",":

        bling.append(dataz[i])

        i += 1

    dataz = dataz[(i+1):]

    club = []

    i = 0

    while dataz[i] != ",":

        club.append(dataz[i])

        i += 1

    dataz = dataz[(i+1):]

    spade = []

    i = 0

    while dataz[i] != ",":

        spade.append(dataz[i])

        i += 1

    dataz = dataz[(i+1):]

    heart = []

    for card in dataz:

        heart.append(card)

    pts = 0

    if trump == "H":

        if (heart.count("A") == 2) and (heart.count("K") == 2) and (heart.count("Q") == 2) and (heart.count("J") == 2) and (heart.count("T") == 2):

            pts += 150

        if (bling.count("A") >= 1) and (bling.count("K") >= 1) and (bling.count("Q") >= 1) and (bling.count("J") >= 1) and (bling.count("T") >= 1):

            if (bling.count("A") == bling.count("K")) and (bling.count("K") == bling.count("Q")) and (bling.count("Q") == bling.count("J")) and (bling.count("J") == bling.count("T")):

                pts += 50*bling.count("A")

            else:

                pts += 50

        if (spade.count("A") >= 1) and (spade.count("K") >= 1) and (spade.count("Q") >= 1) and (spade.count("J") >= 1) and (spade.count("T") >= 1):

            if (spade.count("A") == spade.count("K")) and (spade.count("K") == spade.count("Q")) and (spade.count("Q") == spade.count("J")) and (spade.count("J") == spade.count("T")):

                pts += 50*spade.count("A")

            else:

                pts += 50

        if (club.count("A") >= 1) and (club.count("K") >= 1) and (club.count("Q") >= 1) and (club.count("J") >= 1) and (club.count("T") >= 1):

            if (club.count("A") == club.count("K")) and (club.count("K") == club.count("Q")) and (club.count("Q") == club.count("J")) and (club.count("J") == club.count("T")):

                pts += 50*club.count("A")

            else:

                pts += 50

    if trump == "D":

        if (bling.count("A") == 2) and (bling.count("K") == 2) and (bling.count("Q") == 2) and (bling.count("J") == 2) and (bling.count("T") == 2):

            pts += 150

        if (heart.count("A") >= 1) and (heart.count("K") >= 1) and (heart.count("Q") >= 1) and (heart.count("J") >= 1) and (heart.count("T") >= 1):

            if (heart.count("A") == heart.count("K")) and (heart.count("K") == heart.count("Q")) and (heart.count("Q") == heart.count("J")) and (heart.count("J") == heart.count("T")):

                pts += 50*heart.count("A")

            else:

                pts += 50

        if (spade.count("A") >= 1) and (spade.count("K") >= 1) and (spade.count("Q") >= 1) and (spade.count("J") >= 1) and (spade.count("T") >= 1):

            if (spade.count("A") == spade.count("K")) and (spade.count("K") == spade.count("Q")) and (spade.count("Q") == spade.count("J")) and (spade.count("J") == spade.count("T")):

                pts += 50*spade.count("A")

            else:

                pts += 50

        if (club.count("A") >= 1) and (club.count("K") >= 1) and (club.count("Q") >= 1) and (club.count("J") >= 1) and (club.count("T") >= 1):

            if (club.count("A") == club.count("K")) and (club.count("K") == club.count("Q")) and (club.count("Q") == club.count("J")) and (club.count("J") == club.count("T")):

                pts += 50*club.count("A")

            else:

                pts += 50

    if trump == "S":

        if (spade.count("A") == 2) and (spade.count("K") == 2) and (spade.count("Q") == 2) and (spade.count("J") == 2) and (spade.count("T") == 2):

            pts += 150       

        if (bling.count("A") >= 1) and (bling.count("K") >= 1) and (bling.count("Q") >= 1) and (bling.count("J") >= 1) and (bling.count("T") >= 1):

            if (bling.count("A") == bling.count("K")) and (bling.count("K") == bling.count("Q")) and (bling.count("Q") == bling.count("J")) and (bling.count("J") == bling.count("T")):

                pts += 50*bling.count("A")

            else:

                pts += 50

        if (heart.count("A") >= 1) and (heart.count("K") >= 1) and (heart.count("Q") >= 1) and (heart.count("J") >= 1) and (heart.count("T") >= 1):

            if (heart.count("A") == heart.count("K")) and (heart.count("K") == heart.count("Q")) and (heart.count("Q") == heart.count("J")) and (heart.count("J") == heart.count("T")):

                pts += 50*heart.count("A")

            else:

                pts += 50

        if (club.count("A") >= 1) and (club.count("K") >= 1) and (club.count("Q") >= 1) and (club.count("J") >= 1) and (club.count("T") >= 1):

            if (club.count("A") == club.count("K")) and (club.count("K") == club.count("Q")) and (club.count("Q") == club.count("J")) and (club.count("J") == club..count("T")):

                pts += 50*club.count("A")

            else:

                pts += 50

    if trump == "C":

        if (club.count("A") == 2) and (club.count("K") == 2) and (club.count("Q") == 2) and (club.count("J") == 2) and (club.count("T") == 2):

            pts += 150       

        if (bling.count("A") >= 1) and (bling.count("K") >= 1) and (bling.count("Q") >= 1) and (bling.count("J") >= 1) and (bling.count("T") >= 1):

            if (bling.count("A") == bling.count("K")) and (bling.count("K") == bling.count("Q")) and (bling.count("Q") == bling.count("J")) and (bling.count("J") == bling.count("T")):

                pts += 50*bling.count("A")

            else:

                pts += 50

        if (spade.count("A") >= 1) and (spade.count("K") >= 1) and (spade.count("Q") >= 1) and (spade.count("J") >= 1) and (spade.count("T") >= 1):

            if (spade.count("A") == spade.count("K")) and (spade.count("K") == spade.count("Q")) and (spade.count("Q") == spade.count("J")) and (spade.count("J") == spade.count("T")):

                pts += 50*spade.count("A")

            else:

                pts += 50

        if (heart.count("A") >= 1) and (heart.count("K") >= 1) and (heart.count("Q") >= 1) and (heart.count("J") >= 1) and (heart.count("T") >= 1):

            if (heart.count("A") == heart.count("K")) and (heart.count("K") == heart.count("Q")) and (heart.count("Q") == heart.count("J")) and (heart.count("J") == heart.count("T")):

                pts += 50*heart.count("A")

            else:

                pts += 50

    if bling.count("J")>=1 and spade.count("Q")>=1:

        pts += 4

        if bling.count("J") == spade.count("Q") and bling.count("J") == 2:

            pts += 34

    if (heart.count("A") >= 1) and (bling.count("A") >= 1) and (club.count("A") >= 1) and (spade.count("A") >= 1):

        if (heart.count("A") == bling.count("A")) and (bling.count("A") == club.count("A")) and (club.count("A")==spade.count("A")):

            if heart.count("A") == 1:

                pts += 10

            else:

                pts += 120

        else:

            pts += 10

    if (heart.count("K") >= 1) and (bling.count("K") >= 1) and (club.count("K") >= 1) and (spade.count("K") >= 1):

        if (heart.count("K") == bling.count("K")) and (bling.count("K") == club.count("K")) and (club.count("K")==spade.count("K")):

            if heart.count("K") == 1:

                pts += 8

            else:

                pts += 96

        else:

            pts += 8

    if (heart.count("Q") >= 1) and (bling.count("Q") >= 1) and (club.count("Q") >= 1) and (spade.count("Q") >= 1):

        if (heart.count("Q") == bling.count("Q")) and (bling.count("Q") == club.count("Q")) and (club.count("Q")==spade.count("Q")):

            if heart.count("Q") == 1:

                pts += 6

            else:

                pts += 72

        else:

            pts += 6

    if (heart.count("J") >= 1) and (bling.count("J") >= 1) and (club.count("J") >= 1) and (spade.count("J") >= 1):

        if (heart.count("J") == bling.count("J")) and (bling..count("J") == club.count("J")) and (club.count("J")==spade.count("J")):

            if heart.count("J") == 1:

                pts += 4

            else:

                pts += 48

        else:

            pts += 4

    print pts