#include <iostream>
using namespace std;
template<class T>
class Test
{
public:
Test();
void GetIntoStack(T temp, int nSize);
private:
int m_nLeft;
};
template<class T>
Test<T>::Test()
{
m_nLeft = 0;
}
template<class T>
void Test<T>::GetIntoStack(T temp, int nSize)
{
for ( int i = 0; i < nSize; ++i)
{
if (temp[i] == '(')
{
m_nLeft++;
}
else if (temp[i] == ')')
{
if (m_nLeft < 0)
{
goto Exit0;
}
m_nLeft--;
}
else
{
continue;
}
}
if (0 != m_nLeft)
{
goto Exit0;
}
cout << "YES" << endl;
return;
Exit0:
cout << "NO" << endl;
return;
}
int main()
{
char szTemp[50];
Test<char*> t2;
while (1)
{
cin >> szTemp;
int nSize = strlen(szTemp);
t2.GetIntoStack(szTemp, nSize);
}
return 0;
}