题解 | #扑克牌大小#
扑克牌大小
http://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb
while True:
try:
s = input().split('-')
s1 = s[0].split(' ')
s2 = s[1].split(' ')
d = {'3':0, '4':1, '5':2, '6':3, '7':4, '8':5, '9':6, '10':7, 'J':8, 'Q':9, 'K':10, 'A':11, '2':12, 'joker':13, 'JOKER':14}
#check bomb
b1 = 0
if len(s1) == 4:
b1 = 1
elif len(s1) == 2 and s1[0] == 'joker' and s1[1] == 'JOKER':
b1 = 1
b2 = 0
if len(s2) == 4:
b2 = 1
elif len(s2) == 2 and s2[0] == 'joker' and s2[1] == 'JOKER':
b2 = 1
#个子
if len(s1) == 1 and len(s2) == 1:
if d[s1[0]] > d[s2[0]]:
print(' '.join(s1))
elif d[s1[0]] < d[s2[0]]:
print(' '.join(s2))
elif len(s1) == 1 and b2 == 1:
print(' '.join(s2))
elif len(s2) == 1 and b1 == 1:
print(' '.join(s1))
#对子
if len(s1) == 2 and len(s2) == 2:
if d[s1[0]] > d[s2[0]]:
print(' '.join(s1))
elif d[s1[0]] < d[s2[0]]:
print(' '.join(s2))
elif len(s1) == 2 and b2 == 1 and s1[0] != 'joker':
print(' '.join(s2))
elif len(s2) == 2 and b1 == 1 and s2[0] != 'joker':
print(' '.join(s1))
#三个
if len(s1) == 3 and len(s2) == 3:
if d[s1[0]] > d[s2[0]]:
print(' '.join(s1))
elif d[s1[0]] < d[s2[0]]:
print(' '.join(s2))
elif len(s1) == 3 and b2 == 1:
print(' '.join(s2))
elif len(s2) == 3 and b1 == 1:
print(' '.join(s1))
#顺子
if len(s1) == 5 and len(s2) == 5:
if d[s1[0]] > d[s2[0]]:
print(' '.join(s1))
elif d[s1[0]] < d[s2[0]]:
print(' '.join(s2))
elif len(s1) == 5 and b2 == 1:
print(' '.join(s2))
elif len(s2) == 5 and b1 == 1:
print(' '.join(s1))
#比较炸弹
if len(s1) == 4 and len(s2) == 4:
if d[s1[0]] > d[s2[0]]:
print(' '.join(s1))
elif d[s1[0]] < d[s2[0]]:
print(' '.join(s2))
elif len(s1) == 4 and s2[0] == 'joker' and s2[1] == 'JOKER':
print(' '.join(s2))
elif len(s2) == 4 and s1[0] == 'joker' and s1[1] == 'JOKER':
print(' '.join(s1))
#不可比较
if len(s1) != len(s2) and b1 != 1 and b2 != 1:
print('ERROR')
except:
break