提交时间:2023-08-22 16:04:10
运行 ID: 99285
#include<iostream> #include<cstring> using namespace std; char s; int main() { int tleft=0,tright=0,left=0; while(s!='@') { cin>>s; if(s=='(') { left++; tleft++; } if(s==')'&&left<=0) { cout<<"NO"; return 0; } if(s==')'&&left>0) { tright++; left--;; } if(s=='@') { continue; } } if(tleft==tright){ cout<<"YES"; }else{ cout<<"NO"; } return 0; }