#include<stdio.h>

int main()
{
	int i, j, sCount, mCount, status[50];
	char input[150];
	
	while(1)
	{
		fgets(input, 110, stdin);
		
		sscanf(input, "%[^.]", input);
		printf("%s", input);
		
		if(input[0] == '.')
			break;
		
		sCount = mCount = 0;
		
		i = j = 0;
		while(input[i] != '\0' && sCount > -1 && mCount > -1)
		{
			if(input[i] == '(') {
				status[++j] = 1;
				sCount++;
			} else if(input[i] == ')') {
				if(status[j--] != 1)
					sCount = 0;
				sCount--;
			} else if(input[i] == '[') {
				status[++j] = 2;
				mCount++;
			} else if(input[i] == ']') {
				if(status[j--] != 2)
					sCount = 0;
				mCount--;
			}
			
			i++;
		}
		
		if(sCount == 0 && mCount == 0) {
			printf("yes\n");
		} else {
			printf("no\n");
		}
	}
	
	return 0;
}