</pre><pre class="cpp" name="code">#include<stdio.h>
int main()
{
int ch,count = 0;
while((ch = getchar()) != EOF)
{
if(ch == '{')
{
count++;
}
if(ch == '}' && count == 0)
{
printf("no\n");
return 0;
}
if(ch == '}' && count != 0)
{
count--;
}
}
if(count == 0)
{
printf("yes\n");
}
else
{
printf("no\n");
}
return 0;
}
花括号({})匹配
最新推荐文章于 2020-12-05 23:34:38 发布