S002-AC.cc
368 Bytes
#include <iostream>
using namespace std;
int main()
{
char c;
int score = 0;
while(true)
{
cin >> c;
if(cin.eof())
{
break;
}
if(c == '(')
{
score++;
}
else if(c == ')')
{
if(--score < 0)
{
cout << "no" << endl;
return 0;
}
}
}
if(score)
{
cout << "no" << endl;
return 0;
}
cout << "yes" << endl;
return 0;
}