main :: IO () main = interact $ show . solve solve :: String -> Int solve s = abs (8 - n) where n = length $ init . init $ tail s