#include<stdio.h>
#include<ctype.h>
#include<string.h>

char S[100000];
int top;

int isempty(char);
void push(char);
char pop(void);

int main(void)
{
  char x[500],y;
  int i,len,judge;

  while(1){
    top=101;
    judge=0;
    scanf("%[^\n]%*c",x);
    len=strlen(x);

    if(x[0]=='.' && len==1)break;

    for(i=0;i<len;i++){
      
      if(x[i]=='[' || x[i]=='('){
	push(x[i]);
	judge++;
      }	  
      
      if(x[i]==']' || x[i]==')'){
	y=pop();
	if(x[i]==']'&& y=='[')judge--;
	else if(x[i]==')'&& y=='(')judge--;
      }
    }
      if(judge==0)printf("yes\n");
      else printf("no\n");
  }
  return 0;
}

void push(char x){
  S[++top]=x;
}

char pop(void){
  char x;
  x=S[top--];

  return x;
}