#include #include #include // Yukicoder №201 yukicoderじゃんけん // https://yukicoder.me/problems/no/201 // 1万桁の数値の比較 // *********************** // for debug #define DEBUG #define NOP do{}while(0) #ifdef DEBUG #define TRACE(...) do{printf(__VA_ARGS__);fflush(stdout);}while(0) #define TRACECR do{printf("\n");fflush(stdout);}while(0) #else #define TRACE(...) NOP #define TRACECR NOP #endif #define PRINCR printf("\n") #define NOCR(strig) do{char *p;p=strchr(strig,'\n');if(p)*p='\0';}while(0) // The out-of-date function #define asctime(...) asctime_s(...) #define ctime(...) ctime_s(...) #define strlen(a) mystr_len(a) // for stdio #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0) #define REP(a,b) for(int a=0;a<(int)(b);++a) #define lolong long long #define INPBUF (250+2) static char *getword(char* str) {char c;char *cp;cp=&str[0];c=fgetc(stdin);while( c != EOF ){if((c==' ')||( c=='\n')) break;*cp++=c;c=fgetc(stdin);}*cp='\0';return &str[0];} // *********************** // *********************** // 外部変数 char *pa1; char *pa2; // *********************** int main() { char str[INPBUF]; char name1[INPBUF]; char name2[INPBUF]; int cmpval = 0; char *p1, *p2; int jlen1, jlen2; char c; if((pa1 = (char*)malloc( (100000 + 2)*sizeof(char) )) == NULL ) return 13; if((pa2 = (char*)malloc( (100000 + 2)*sizeof(char) )) == NULL ) { free(pa1);return 13;} p1 = pa1; getword(name1); while((c = getchar())!= ' ' ) *p1++ = c; *p1 = '\0'; jlen1 = p1 - pa1; getword(str); getword(name2); p2 = pa2; while((c = getchar())!= ' ' ) *p2++ = c; *p2 = '\0'; jlen2 = p2 - pa2; if( jlen1 == jlen2 ) { p1 = pa1; p2 = pa2; while( *p1 != '\0' ) { if( *p1 > *p2 ) { cmpval = 1; break; } else if( *p1 < *p2 ) { cmpval = 2; break; } p1++; p2++; } } else { if( jlen1 > jlen2 ) { cmpval = 1; } else { cmpval = 2; } } if( cmpval == 1 ) { printf("%s\n", name1 ); } else if( cmpval == 2 ) { printf("%s\n", name2 ); } else { printf("-1\n" ); } free( pa2 ); free( pa1 ); return 0; }