HJ88 扑克牌大小
扑克牌大小
https://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); String[] split = s.split("-"); String s1 = split[0]; String s2 = split[1]; String test = "345678910JQKA2jokerJOKER"; if("joker JOKER".equals(s1) || "joker JOKER".equals(s2)) { System.out.println("joker JOKER"); } else { String[] split1 = s1.split(" "); String[] split2 = s2.split(" "); if (split1.length != split2.length) { if (split1.length == 4 || split2.length == 4) { System.out.println(split1.length == 4 ? s1 : s2); } else { System.out.println("ERROR"); } } else { System.out.println(test.indexOf(split1[0]) > test.indexOf(split2[0]) ? s1 : s2); } } } }