#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 60;
char s[N];
int main()
{
    scanf("%s", s);
    int n = strlen(s);
    for (int i = 0, j = n; i < j;)
        if (s[i++] == s[--j]) return puts("NO"), 0;
    stack<char> st;
    for (int i = 0; i < n; i++)
        if (!st.empty() && st.top() == '(' && s[i] == ')')
            st.pop();
        else
            st.push(s[i]);
    puts(st.empty() ? "YES" : "NO");
    return 0;
}
