(define (main args) (let* ([n (string->number (read-line))] [pl (string->list (read-line))] [rv (make-vector (+ n 1) 0)]) (let loop ([st '()] [pl pl] [i 1]) (cond [(null? pl) #t] [(char=? (car pl) #\() (loop (cons i st) (cdr pl) (+ i 1))] [else (vector-set! rv (car st) i) (vector-set! rv i (car st)) (loop (cdr st) (cdr pl) (+ i 1))])) (vector-for-each-with-index (lambda (i x) (if (> i 0) (print x))) rv)) 0)