east :: String -> Int-> [Int]
east [] n = []
east (x:xs) n 
  | x == 'E' = (n+1) : (east xs (n+1))
  | otherwise = n : (east xs n)

west :: String -> Int -> [Int]
west [] n = []
west (x:xs) n 
  | x == 'W' = (n+1) : (west xs (n+1))
  | otherwise = n : (west xs n)

main = do
  n <- (read :: String -> Int) <$> getLine
  s <- getLine
  let y = zipWith (+) (reverse $ east (reverse s) 0) (west s 0)
  putStrLn . show $ (-) (minimum y) 1
  putStrLn . show . reverse $ east (reverse s) 0
  putStrLn . show $ west s 0
