题解 | #扑克牌大小#
扑克牌大小
https://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb
def dx(s):
if s=="10":
return ord("9")+1
if s=="joker":
return ord("9")+7
if s=="JOKER":
return ord("9")+8
if ord("3")<=ord(s)<=ord("9"):
return ord(s)
if s=="J":
return ord("9")+2
if s=="Q":
return ord("9")+3
if s=="K":
return ord("9")+4
if s=="A":
return ord("9")+5
if s=="2":
return ord("9")+6
def ptype(s):
if s=="joker JOKER":
return "tt"
s=s.split()
if len(s)==1:
return "1"
if len(s)==2:
return "2"
if len(s)==3:
return "3"
if len(s)==4:
return "t"
if len(s)==5:
return "5"
def fun(a,b):
if a=="joker JOKER" or b=="joker JOKER":
return "joker JOKER"
if ptype(a)=="t" or ptype(b)=="t":
if ptype(a)=="t" and ptype(b)=="t":
return a if dx(a.split()[0])>dx(b.split()[0]) else b
return a if ptype(a)=="t" else b
if ptype(a)==ptype(b):
return a if dx(a.split()[0])>dx(b.split()[0]) else b
return "ERROR"
l=input().split("-")
a,b=l[0],l[1]
print(fun(a,b))