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

int main()
{
  int i,j,n1,n2,head;
  char S[102],SS[102];

  while(1){
    fgets(S,sizeof(S),stdin);
    if(S[0]=='.')break;
    head=0;
    for(i=0;i<strlen(S);i++){
      if(S[i]=='[' ||S[i]=='(' ||S[i]==')' ||S[i]==']'){
	SS[head++]=S[i];
      }
      if(S[i]==']' &&SS[head-2]=='[')head-=2;
      if(S[i]==')' &&SS[head-2]=='(')head-=2;
    }
    if(head==0)printf("yes\n");
    else printf("no\n");
    
  }
  
  return 0;
}