while ((line = await readline())) {
let line1 = line.split("-");
let a = line1[0].split(" ");
let b = line1[1].split(" ");
let arr = [
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"J",
"Q",
"K",
"A",
"2",
"joker",
"JOKER",
];//预定义比较数组
if (a.length !== b.length) {//这是两手牌数量不相等的情况
if (
(a.length == 4 || b.length == 4) &&
a[0] !== "joker" &&
b[0] !== "joker"//如果其中一手为炸弹并且不是王炸的时候
) {
a.length == 4
? console.log(a.join(" "))
: console.log(b.join(" "));//炸弹赢
} else if (a[0] == "joker" || b[0] == "joker") {//如果其中一手为王炸
a[0] == "joker"
? console.log(a.join(" "))
: console.log(b.join(" "));//王炸赢
} else console.log("ERROR");//否则无法比较
} else {//牌的数量相等的情况
if (a.length == 2) {
if (a[0] == "joker" || b[0] == "joker")
a[0] == "joker"//如果牌的数量为2则判断是否为王炸
? console.log(a.join(" "))
: console.log(b.join(" "));
else
arr.indexOf(a[0]) > arr.indexOf(b[0])//否则按照预定义的数组比较大小
? console.log(a.join(" "))
: console.log(b.join(" "));
} else {若牌的数量不为2则按照预定义的数组比较大小
arr.indexOf(a[0]) > arr.indexOf(b[0])
? console.log(a.join(" "))
: console.log(b.join(" "));
}
}
}