Untitled
unknown
plain_text
5 years ago
520 B
5
Indexable
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> char stack[102 * 1024]; signed main() { char c; int top = 0; while ((c = getc(stdin)) != EOF) { if (c == '[') stack[top++] = ']'; else if (c == '<') stack[top++] = '>'; else if (c == '{') stack[top++] = '}'; else if (c == '(') stack[top++] = ')'; else if (top && c == stack[top - 1]) --top; else { printf("NO"); return 0; } } printf("YES"); }
Editor is loading...