#include<string>
using namespace std;
int main()
{
int n,a,b;
string str;
cin >> n;
cin.ignore();
for (int i = 0;i < n; i++)
{
a = 0;
b = 0;
getline(cin,str);
for (int j = 0;j < str.length(); j++)
{
if (str[j] == '(')
{
a++;
}
else
{
b++;
}
}
if (a == b)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
沒有留言:
張貼留言