• + 0 comments

    Haskell

    import Data.List
    
    solve :: String -> String
    solve = foldr (\x acc -> if (length x) == 1 then (head x):acc else [head x] ++ (show $ length x) ++ acc) "" . group
    
    main = interact $ solve