#include<stdio.h> #include<string.h> void deal(char s[],int *type,int *val){ int v; // 判断王的情况 if(strcmp(s,"joker")==0){ *type = 1; //单牌 *val = 14; return; } else if(strcmp(s,"JOKER")==0){ *type = 1; //单牌 *val = 15; return; } else if(strcmp(s,"joker JOKER")==0 || strcmp(s,"JOKER joker")==0){ *type = 0; //炸 *val = 15*4; return; } int len = strlen(s); int count = 0; int f1 = 1; for(int i=0;i<len;i++){ if(s[i]==' ' || i==len-1){ count++; } } if(s[0]=='1'&&s[1]=='0') *val = 8; else if(s[0]>='3' && s[0]<='9') *val = s[0]-'3'+1; else if(s[0]=='A') *val = 12; else if(s[0]=='2') *val = 13; else *val = s[0]-'J'+9; *type = count; } int main(){ char str[100] = {0}; char s1[100] = {0}; char s2[100] = {0}; int t1,t2,v1,v2; fgets(str,sizeof(str),stdin); int len = strlen(str)-1; int i; for(i=0;i<len;i++){ if(str[i]!='-') s1[i] = str[i]; else break; } for(int j=i+1;j<len;j++){ s2[j-i-1] = str[j]; } deal(s1,&t1,&v1); deal(s2,&t2,&v2); int res=0; if(t1==t2){ res = v1>=v2?1:2; } else if((t1==0 || t1==4)&& t2!=0){ res = 1; } else if((t2==0 || t2==4) && t1!=0){ res = 2; } if(res==1) printf("%s",s1); else if(res==2) printf("%s",s2); else printf("ERROR"); }