提交时间:2023-08-22 16:17:13
运行 ID: 99334
#include<bits/stdc++.h> using namespace std; int main() { bool flag=1; stack<char> t; char a; while(cin>>a) { if(a=='(' || a=='[') t.push(a); else if(a==')'&&t.top()=='(' || a==']'&&t.top()=='[') t.pop(); } if(t.empty()) cout<<"OK"; else cout<<"Wrong"; }