#include #include typedef struct listNode { int id; struct listNode *next; } listNode; listNode *appendNode(int id, listNode *head) { listNode *new = malloc(sizeof(listNode)); new->id = id; new->next = NULL; head->next = new; return new; } int main(void) { listNode* head = malloc(sizeof(listNode)); listNode* ptr = head; int size = 0; int buf; while ((scanf("%d,", & buf) != EOF)) { ptr = appendNode(buf, ptr); size++; } if (size <= 1) { printf("Yes"); return 0; } int ans[size]; head = head->next; for (int i = 0; i < size; i ++) { ans[i] = head->id; head = head->next; } int isCentral = 1; for (int i = 0, end = size / 2; i < end; i++) { if (ans[i] != ans[size - i - 1]) { isCentral = 0; } } if (isCentral == 1) { printf("Yes"); } else { printf("No"); } return 0; }