loop do
  str   = gets.chomp.chars
  stack = []
  if str == ["."] then exit end
  cont = true

  str.each do |x|
    if x == "["
      stack << "["
    elsif x == "("
      stack << "("
    elsif x == "]"
      if stack[-1] == "["
        stack.pop
      else
        cont = false
      end
    elsif x == ")"
      if stack[-1] == "("
        stack.pop
      else
        cont = false
      end
    end
  end
  puts stack.size == 0 && cont == true ? :yes : :no
end

