#include #include #include #include bool check1(char *); bool check2(char *); int main(void) { char in1[6], in2[6]; scanf("%s", in1); scanf("%s", in2); if (!check1(in1)) return EXIT_SUCCESS; if (!check1(in2)) return EXIT_SUCCESS; if (!check2(in1)) return EXIT_SUCCESS; if (!check2(in2)) return EXIT_SUCCESS; printf("OK"); return EXIT_SUCCESS; } bool check1(char *s) { int num; sscanf(s, "%d", &num); if (num > 12345) { printf("NG"); return false; } return true; } bool check2(char *s) { if (*s == '0' && strlen(s) > 1) { printf("NG"); return false; } while (*s != '\0') { if (*s < '0' || *s > '9') { printf("NG"); return false; } s++; } return true; }