Linux words by croyal

(defn m[s i c](if(= c(. s charAt i)) 0 1))
(defn n[w]
   (loop[s w i 2 t 0]
      (if (< i (- (. s length) 2))
         (if (not= \n (. s charAt i))
            (recur s (inc i) (inc t))
            (recur s (inc i) t))
(loop[s (read-line)]
   (when(not= s nil)
      (if (<(. s length)5)
         (println -1)
         (let[w(. s toLowerCase)]
            (println (+ (m w 0 \l)(m w 1 \i)(n w)(m w (- (. w length) 2) \u)(m w (- (. w length) 1) \x)))))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).


return to the top page