#include <algorithm> #include <iostream> #include <string> using namespace std; string ismax(const string &s ) { if(s.find("joker JOKER")!=string::npos) return "joker JOKER"; string car1,car2; int data=s.find("-"); car1=s.substr(0,data);//分开两手牌 car2=s.substr(data+1); int car1_num,car2_num; car1_num=count(car1.begin(),car1.end(),' ')+1;//算出两手排的张数 car2_num=count(car2.begin(), car2.end(),' ')+1; string car1_first,car2_first; car1_first=car1.substr(0,car1.find(' ')); car2_first=car2.substr(0,car2.find(' ')); string tmp="345678910JQKA2jokerJOKER"; if(car1_num==car2_num) { if(tmp.find(car1_first)>tmp.find(car2_first)) return car1; return car2; } else if(car1_num!=car2_num) { if(car1_num==4) return car1; else if(car2_num==4) return car2; } return "ERROR"; } int main() { string line,res; while(getline(cin,line)) { res=ismax(line); cout<<res<<endl; } return 0; }