import java.io.BufferedReader;  
import java.io.IOException;  
import java.io.InputStreamReader;  
import java.util.Stack;  
  
class Main {  
    public static void main(String[] args) throws IOException {  
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  
        StringBuilder sb = new StringBuilder();  
        while (true) {  
            String s = br.readLine();  
            if (s.equals(".")) break;  
            Stack<Character> stack = new Stack<>();  
            boolean success = true;  
            for (char c : s.toCharArray()) {  
                if (c == '(') {  
                    stack.push(c);  
                }  
                if (c == ')') {  
                    if(stack.isEmpty() || stack.peek() != '(') {  
                        success = false;  
                        break;  
                    }else {  
                        stack.pop();  
                        continue;  
                    }  
                }  
                if (c == '[') {  
                    stack.push(c);  
                }  
                if (c == ']') {  
                    if(stack.isEmpty() || stack.peek() != '[') {  
                        success = false;  
                        break;  
                    }else {  
                        stack.pop();  
                        continue;  
                    }  
                }  
            }  
            if (success && stack.isEmpty()) {  
                sb.append("yes\n");  
            } else {  
                sb.append("no\n");  
            }  
        }  
        System.out.println(sb);  
    }  
}