提交时间:2023-08-22 16:26:57

运行 ID: 99386

#include<bits/stdc++.h> using namespace std; int main() { bool flag=1; stack<char> t; char a; cin>>a; while(a!='@') { if(a=='(' || a=='[') t.push(a); else if(a==')'&&t.top()=='(' || a==']'&&t.top()=='[') t.pop(); cin>>a; } if(t.empty()) cout<<"OK"; else cout<<"Wrong"; }