You are viewing a single comment's thread. Return to all comments →
Haskell:
module Main where import Data.List (transpose) solve :: String -> String solve plain = encrypted where plain' = filter (/= ' ') plain len = length plain' rows = floor . sqrt $ fromIntegral len cols = ceiling . sqrt $ fromIntegral len grid = [take cols $ drop (i * cols) plain' | i <- [0 .. rows]] grid' = filter (/= "") grid -- edge case, final is "" encrypted = unwords $ transpose grid main :: IO () main = interact solve
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →
Haskell: