You are viewing a single comment's thread. Return to all comments →
My erlang solution:
-module(solution). -export([main/0]). rotate_and_print([S1|[]], S2) -> io:format("~s~n", [string:join([S2, [S1]], "")]); rotate_and_print([S1|Sx1], S2) -> io:format("~s ", [string:join([Sx1, S2, [S1]], "")]), rotate_and_print(Sx1, lists:concat([S2, [S1]])). main() -> {ok, [N]} = io:fread("", "~d"), lists:map(fun(_) -> {ok, [S]} = io:fread("", "~s"), rotate_and_print(S, []) end, lists:seq(1, N)).
Rotate String
You are viewing a single comment's thread. Return to all comments →
My erlang solution: