题目
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] ss = s.split("-");
StringBuffer s1 = new StringBuffer();
StringBuffer s2 = new StringBuffer();
for(int i=0;i<ss[0].length();i++) {
if(ss[0].charAt(i)!=' ')
s1.append(ss[0].charAt(i));
}
for(int i=0;i<ss[1].length();i++) {
if(ss[1].charAt(i)!=' ')
s2.append(ss[1].charAt(i));
}
//对王
if(s1.charAt(0) == 'j') {
for(int i=0;i<s1.length();i++) {
if(i == 4)
System.out.print(s1.charAt(i)+" ");
else
System.out.print(s1.charAt(i));
}
return ;
}
if(s2.charAt(0) == 'j') {
for(int i=0;i<s2.length();i++) {
if(i == 4)
System.out.print(s2.charAt(i)+" ");
else
System.out.print(s2.charAt(i));
}
return ;
}
//10(个子)与其他个子比较
if(s1.length() == 1 && s2.length() == 2) {
if(s2.charAt(0) == '1' && s2.charAt(1) == '0') {
if(s1.charAt(0) == 'J' || s1.charAt(0) == 'Q' || s1.charAt(0) == 'K' || s1.charAt(0) == 'A' || s1.charAt(0) == '2') {
System.out.println(s1);
return ;
}else {
System.out.println(s2);
return ;
}
}
}
//10与其他对子比较
if(s1.length() == 4 && s2.length() == 2
||s2.length() == 4 && s1.length() == 2) {
if(s1.charAt(0) == '1' && s1.charAt(1) == '0') {
if(s2.charAt(0) == 'J'||s2.charAt(0) == 'Q'||s2.charAt(0) == 'K'||s2.charAt(0) == 'A'||s2.charAt(0) == '2') {
for(int i=0;i<s2.length();i++) {
if(i == 0)
System.out.print(s2.charAt(i)+" ");
else
System.out.print(s2.charAt(i));
}
return ;
}else {
for(int i=0;i<s1.length();i++) {
if(i == 0)
System.out.print(s1.charAt(i)+" ");
else
System.out.print(s1.charAt(i));
}
return ;
}
}else if(s2.charAt(0) == '1' && s2.charAt(1) == '0'){
if(s1.charAt(0) == 'J'||s1.charAt(0) == 'Q'||s1.charAt(0) == 'K'||s1.charAt(0) == 'A'||s1.charAt(0) == '2') {
for(int i=0;i<s1.length();i++) {
if(i == 0)
System.out.print(s1.charAt(i)+" ");
else
System.out.print(s1.charAt(i));
}
return ;
}else {
for(int i=0;i<s2.length();i++) {
if(i == 0)
System.out.print(s2.charAt(i)+" ");
else
System.out.print(s2.charAt(i));
}
return ;
}
}
}
//都是四个
if(s1.length() == 4 && s2.length() == 4) {
if(s1.charAt(0) > s2.charAt(0)) {
for(int i=0;i<s1.length();i++) {
System.out.print(s1.charAt(i)+" ");
}
return ;
}else {
for(int i=0;i<s2.length();i++) {
System.out.print(s2.charAt(i)+" ");
}
return ;
}
}
//炸弹与对王比较
if(s1.length() == 4 && s2.length() != 4) {
if(s2.charAt(0) == 'j') {
for(int i=0;i<s2.length();i++) {
if(i == 4)
System.out.print(s2.charAt(i)+" ");
else
System.out.print(s2.charAt(i));
}
return ;
}else {
for(int i=0;i<s1.length();i++) {
System.out.print(s1.charAt(i)+" ");
}
return ;
}
}
if(s1.length() != 4 && s2.length() == 4) {
if(s1.charAt(0) == 'j') {
for(int i=0;i<s1.length();i++) {
if(i == 4)
System.out.print(s1.charAt(i)+" ");
else
System.out.print(s1.charAt(i));
}
return ;
}else {
for(int i=0;i<s2.length();i++) {
System.out.print(s2.charAt(i)+" ");
}
return ;
}
}
//都是顺子(连续5张可不一定是5张可能为6张(10)占两个位置)
if(s1.length() == 5 && s2.length() == 5) {
if(s1.charAt(0) > s2.charAt(0)) {
for(int i=0;i<s1.length();i++) {
System.out.print(s1.charAt(i)+" ");
}
return ;
}else {
for(int i=0;i<s2.length();i++) {
System.out.print(s2.charAt(i)+" ");
}
return ;
}
}
if(s1.length() == 5 && s2.length() == 6) {
System.out.print(10+" ");
for(int i=2;i<s2.length();i++){
System.out.print(s2.charAt(i)+" ");
}
return ;
}else{
System.out.print("ERROR");
}
sc.close();
}
}