#include <iostream>
#include <cstdlib>
using namespace std;
#define maxsize 30
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
char c[256];
bool judge(char c[256]){
int top=0,i=0;
while(c[i]!='@'){
if(c[i]=='(')
top++;
if(c[i]==')'){
if(top>0)
top--;
else return 0;
}
i++;
}
if(top!=0) return false;
else
return true;
}
int main(int argc, char** argv) {
cin>>c;
if(judge(c)==1)
cout<<"yes";
else
cout<<"no";
return 0;
}
括号的匹配(只有小括号)
最新推荐文章于 2024-08-02 19:33:50 发布