• + 0 comments

    Here's my haskell solution.

    allRotations s = build (length s) s
      where
        build 0 s = []
        build n s = let s' = rotl s in s' : build (n - 1) s'
        rotl s = tail s ++ [head s]
    
    main = interact (unlines . map (unwords . allRotations) . tail . lines)