#include <stdio.h>
#include <string.h>
#define N 100
int main(void)
{
  char s[N+1];
  int i,cml,cmr,ckl,ckr,nml,nmr,nkl,nkr;
  while(fgets(s,N,stdin)&&s[0]!='.'){
    cml=0;cmr=0;ckl=0;ckr=0;nml=0;nmr=0;nkl=0;nkr=0;
    for(i=0;i<strlen(s);i++){
      if(s[i]=='('){
	cml++;
	nml+=i;
      }
      else if(s[i]==')'){
	cmr++;
	nmr+=i;
      }
      else if(s[i]=='['){
	ckl++;
	nkl+=i;
      }
      else if(s[i]==']'){
	ckr++;
	nkr+=i;
      }
    }
    //printf("%d %d %d %d %d %d %d %d\n",cml,cmr,ckl,ckr,nml,nmr,nkl,nkr);
    if(cml==cmr&&ckl==ckr&&nml<nmr&&nkl<nkr)
      puts("yes");
    else
      puts("no");
  }
  return 0;
}