帮忙看一上 如何输出不对额。

帮忙看一下 怎么输出不对额。。
#include <iostream>
#include <stack>
#include <string>
using namespace std;

bool Test(char a,char s)//测试两字符是否匹配()或{}或【】 
{
   
   
  if(a=='{'&&s=='}')
  return true;
  else if(a=='('&&s==')')
  return true;
  else if(a=='['&&s==']')
  return true;
   
  return 0;
   
}
int main()
{
  int n;
  cin>>n;
   
  for(int i=0;i<n;++i)
  {
  stack<char> b;//定义栈 
  string s;
  cin>>s;
  int l=s.size();
  char c;
  for(int j=0;j<l;++j)
  {
  c=s[j];
  if(!b.empty()&&Test(b.top(),c))//匹配则出栈 否则入栈 
  b.pop();
  else
  b.push(c);
  }
  if(b.empty())
  cout<<"YES"<<endl;
  else
  cout<<"NO"<<endl;
  }
   
  system("pause");  
  return 0;
}


------解决方案--------------------
探讨
不是 输入时可以带其它字符的 结果就不对了。。比如输入a,输出应为no、、

引用:

没有问题啊,是你输入的不对吧?
输入次数:
2

第一次输入要检验的字串:
{[]}()
输出:
YES

第而次输入要检验的字串:
{}[)
输出:
NO
请按任意键继续...