(define (shori-hantei xs) (letrec ((len (string-length xs)) (inner (lambda (m east west) (cond ((= 3 east) "East") ((= 3 west) "West") ((<= len m) "NA") (else (let ((ch (string-ref xs m))) (cond ((char=? ch #\O) (inner (+ 1 m) (+ 1 east) 0)) ((char=? ch #\X) (inner (+ 1 m) 0 (+ 1 west))) (else (inner (+ 1 m) east west))))))))) (inner 0 0 0))) (print (shori-hantei (read-line)))