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

char str[120];
size_t size;

int dfs(int *i) {
  //printf("called %d\n", *i);
  int j, k;
  for (;*i < size; ++*i) {
    if (str[*i] == '(' || str[*i] == '[') {
      break;
    }
    if (str[*i] == ')' || str[*i] == ']') {
      // printf("fail");
      return 0;
    }
  }
  // printf("a %d", *i);

  if (*i == size) {
    return 1;
  }

  char end = ')', fail = ']';
  if (str[*i] == '[') end = ']', fail = ')';

  for (++*i; *i < size; ++*i) {
    if (str[*i] == end) {
      return 1;
    } else if (str[*i] == fail) {
      return 0;
    }else if(str[*i] == '(' || str[*i] == '[') {
      if(dfs(i) == 0) {
        return 0;
      }
    }
  }
  return 0;
}

int main(void) {
  while (1) {
    fgets(str, 110, stdin);
    size = strlen(str);
    while(str[size-1] == '\n')--size;
    
    if (size == 1 && str[0] == '.') return 0;

    int i = 0;

    int flag = 1;
    while(i < size) {
      if(!dfs(&i)) {
        flag = 0;
        break;
      }
      ++i;
    }
    if(flag) {
      puts("yes");
    }else {
      puts("no");
    }
  }

}
