#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 255
typedef struct {
char *top;
char *base;
int stacksize;
}SqStack;
int InitStack(SqStack S){
S->base=(char)malloc(MAXSIZE*sizeof(char));
if(!S->base){
return 0;
}else{
S->stacksize=MAXSIZE;
return 1;
}
}
int Puch(SqStack *S, char e){
if(S->top-S->base==S->stacksize){
return 0;
}else{
*S->top=e;
S->top++;
return 1;
}
}
int Pop(SqStack *S, char x){
if(S->top==S->base){
return 0;
}else{
S->top--;
x=*S->top;
return 1;
}
}
char GetTop(SqStack *S){
if(S->top!=S->base){
return *(S->top-1);
}else{
return 0;
}
}
int StackEmpty(SqStack *S){
if(S->top==S->base){
return 1;
}else{
return 0;
}
}
int Matching(){
SqStack S;
InitStack(&S);
int flag=1;
char ch,x;
scanf("%c",&ch);
while(ch!='@'){
switch(ch){
case'(':
Puch(&S,ch);
flag=0;
break;
case')':
if(!StackEmpty(&S)&&GetTop(&S)=='('){
Pop(&S,x);
flag=1;
}else{
flag=0;
}
break;
}
scanf("%c",&ch);
}
if(!StackEmpty(&S)&&flag){
return 1;
}else{
return 0;
}
}
int main(){
int h;
h=Matching();
if(h==1){
printf("YES");
}else{
printf("NO");
}
}