现在的位置: 首页 > 综合 > 正文

hdu1870

2018年02月22日 ⁄ 综合 ⁄ 共 344字 ⁄ 字号 评论关闭
#include<stdio.h>
int
main()
{
    int
i,top;
    char
ch[1005],str[1005];
    while(scanf("%s",ch)==1)
    {
       
top=0;
       
for(i=0;ch[i]!='\0';i++)
       
{
           
if(ch[i]=='(')
              
str[top++]=ch[i];
              
else if(ch[i]==')')
              
top--;
              
else
              
break;
       
}
       
printf("%d\n",top);
    }
    return
0;
}

抱歉!评论已关闭.