You are viewing a single comment's thread. Return to all comments →
common lisp solution
(defun nswap-adjacent (str) (let ((len (length str))) (do ((i 0 (+ 2 i))) ((>= i len) str) (rotatef (elt str i) (elt str (1+ i)))))) (dotimes (i (read) 'done) (princ (nswap-adjacent (read-line))) (princ #\newline))
Seems like cookies are disabled on this browser, please enable them to open this website
String-o-Permute
You are viewing a single comment's thread. Return to all comments →
common lisp solution