#include <stdio.h>
#include <string.h>
int f;
char s[101];
int i;
int na,nb,nc,nd;
void judge(int n,char c){
	for(i=n+1;s[i];i++){
		if(c=='('){
			if(s[i]=='('||s[i]=='[')
				judge(i,s[i]);
			else if(s[i]==']'){
				f=0;
			}
			else if(s[i]==')')
				break;
		}
		else if(c=='['){
			if(s[i]=='('||s[i]=='[')
				judge(i,s[i]);
			else if(s[i]==')'){
				f=0;
			}
			else if(s[i]==']')
				break;
		}
	}
}
int main(void){
	while(1){
		f=1;
		na=nb=nc=nd=0;
		fgets(s,101,stdin);
		s[strlen(s)]='\0';
		if(s[0]=='.')
			break;
		for(i=0;s[i];i++){
			if(s[i]==')'){
				nb++;
				if(na<nb)
					f=0;
			}
			else if(s[i]==']'){
				nd++;
				if(nc<nd)
					f=0;
			}
			else if(s[i]=='('||s[i]=='['){
				if(s[i]=='(')
					na++;
				else if(s[i]=='[');
					nc++;
				judge(i,s[i]);
			}
		}
		if(f)
			puts("yes");
		else
			puts("no");
	}
	return 0;
}