(ns clojure.examples.hello (:gen-class)) (require '[clojure.string :as str]) (defn uno [s] (let [l (map read-string (str/split s #""))] (apply + (keep-indexed #(if (= (nth l (mod (inc %1) (count l))) %2) %2) l)))) (defn duo [s] (let [l (map read-string (str/split s #""))] (apply + (keep-indexed #(if (= (nth l (mod (+ %1 (/ (count l) 2)) (count l))) %2) %2) l)))) (println (uno (read-line)))
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more