import java.util.Scanner;
public class Poker {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String inputStr=sc.nextLine();
String[] str=inputStr.split("-");
System.out.println(compare(str[0], str[1]));
}
private static String compare(String str1,String str2){
String temp1=str1,temp2=str2;
str1=str1.replace("joker", "16");
str1=str1.replace("JOKER", "17");
str1=str1.replace("J", "11");
str1=str1.replace("Q", "12");
str1=str1.replace("K", "13");
str1=str1.replace("A", "14");
str1=str1.replace("2", "15");
str2=str2.replace("joker", "16");
str2=str2.replace("JOKER", "17");
str2=str2.replace("J", "11");
str2=str2.replace("Q", "12");
str2=str2.replace("K", "13");
str2=str2.replace("A", "14");
str2=str2.replace("2", "15");
String[] str01=str1.split(" ");
String[] str02=str2.split(" ");
if(str01.length==str02.length){
if(Integer.parseInt(str01[0])>Integer.parseInt(str02[0])){
return temp1;
}else return temp2;
}else{
//对王和普通1,3,5的情况
if(str01.length==2&&str02.length!=4){
if(str01[0].equals("16")||str01[0].equals("17")){
return temp1;
}
return "ERROR";
}else if(str02.length==2&&str01.length!=4){
if(str02[0].equals("16")||str02[0].equals("17")){
return temp2;
}
return "ERROR";
//普通1,3,5和炸弹的情况
}else if(str01.length!=2&&str02.length==4){
return temp2;
}else if(str02.length!=2&&str01.length==4){
return temp1;
}else if(str01.length==2&&str02.length==4){
if(str01[0].equals("16")||str01[0].equals("17")){
return temp1;
}
return temp2;
}else if(str01.length==4&&str02.length==2){
if(str02[0].equals("16")||str02[0].equals("17")){
return temp2;
}
return temp1;
}else
return "ERROR";
}
}
}
有一个测试用例未通过
Poker大小
最新推荐文章于 2018-12-31 08:58:00 发布