main = getLine >> getContents >>= print . solve . lines solve :: [String] -> Int solve [[], []] = 0 solve [(x : xs), (y : ys)] | x == y = solve [xs, ys] | otherwise = 1 + solve [xs, ys]