1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys

def f(c):
  s = len(set(c[0::2])) == 1
  r = ''.join(sorted(c[1::2]))
  l = len(set(r))
  if l == 2:
    print 'Four of a kind' if r.count(r[0]) in [1,4] else 'Full house'
  elif l == 5:
    if '2345A23456789T789JT89JQT9JKQTAJKQT'.find(r) >= 0:
      print ('Royal flush' if r == 'AJKQT' else 'Straight flush') if s else 'Straight'
    elif s:
      print 'Flush'
    else:
      print 'No pair'
  elif s:
    print 'Flush'
  elif l == 3:
    print 'Three of a kind' if [i for i in set(r) if r.count(i) >= 3] else 'Two pair'
  else:
    print 'One pair'

f(sys.argv[1])