Skip to content

Instantly share code, notes, and snippets.

@tamamu
Created December 13, 2015 13:23
Show Gist options
  • Save tamamu/669c62ed7ae04fb0a378 to your computer and use it in GitHub Desktop.
Save tamamu/669c62ed7ae04fb0a378 to your computer and use it in GitHub Desktop.
(defun parse (str)
(loop for i from 0 below (length str)
if (eq (aref str i) #\Space)
return (values (subseq str 0 i)
(subseq str (1+ i)))))
(defun crz (x y)
(case x
(#\0 (case y
(#\0 #\1)
((#\1 #\2) #\0)))
(#\1 (case y
(#\0 #\1)
(#\1 #\0)
(#\2 #\2)))
(#\2 (case y
((#\0 #\1) #\2)
(#\2 #\1)))))
(defun call-crz (str)
(multiple-value-bind (x y) (parse str)
(map 'vector #'crz x y)))
(loop for l = (read-line)
while l
do (format t "~a~%" (coerce (call-crz l) 'string)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment