提交时间:2023-08-22 16:05:46

运行 ID: 99293

#include <bits/stdc++.h> using namespace std; char st[10005]; int main() { char s[10005]; int cur=0; cin >> s; for (int i = 0;; i++) { char c = s[i]; if (c == '@') break; if (c == '(' || c == '[') { st[cur++] = c; } else { char target = st[--cur]; if (!((c == ')' && target == '(') || (c == ']' && target == '['))) { cout << "Wrong" << endl; return 0; } } } if (cur != 0) { cout << "Wrong" << endl; } else cout << "OK" << endl; return 0; }