print map{s/\?$/? /?print(STDERR)&&(<>=~/.*/g)[0]:split('\|')&&$_[rand@_]} map{split/\[(.+?)\]/}<>