#include #include #include #include int main() { enum SUCCESS { NONE, YES, NO, }; int turn = 0; int nums[10] = { 0 }; int isExist = false; for (int i = 0;i < turn;i++) { char str[10] = ""; int num[4] = {0}; for (int j = 0;j < 4;j++) { scanf("%d", &num[i]); } scanf("%s", str); if (str == "YES") { for (int j = 0;j < 4;j++) { if (nums[num[j]] < YES) { nums[num[j]] = YES; } } isExist = true; } else { for (int j = 0;j < 4;j++) { if (nums[num[j]] < NO) { nums[num[j]] = NO; } } } } if (isExist) { for (int i = 0;i < 10;i++) { if (nums[i] == YES) { printf("%d", i); return 0; } } } else { for (int i = 0;i < 10;i++) { if (nums[i] == 0) { printf("%d", i); return 0; } } } return 0; }