import Data.List


commonPrefix2 (x:xs) (y:ys) | x == y = x: commonPrefix2 xs ys
commonPrefix2 _ _ = []


commonPrefix (xs:xss) = foldr commonPrefix2 xs xss
commonPrefix _ = []


splitPath = groupBy (\_ c -> c /= '/')




commonDirPath = concat . commonPrefix . map splitPath

main = putStrLn $ commonDirPath [
        "/home/user1/tmp/coverage/test",
        "/home/user1/tmp/covert/operator",
        "/home/user1/tmp/coven/members"
       ]