solve :: String -> Int -> [Int]
solve _ 0 = []
solve x n = (length $ (filter (== 'W') (take (n-1) x)) ++ (filter (== 'E') (drop n x))) : solve x (n-1)

main = do
  n <- read <$> getLine
  s <- getLine
  putStrLn . show . minimum $ solve s n
  putStrLn . show $ solve s n
