You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
519 B
Clojure
29 lines
519 B
Clojure
3 years ago
|
(require '[clojure.string :as str])
|
||
|
|
||
|
(loop [sum 0]
|
||
|
(let [line (read-line)]
|
||
|
(if (empty? line)
|
||
|
(println sum)
|
||
|
(recur
|
||
|
(+
|
||
|
sum
|
||
|
(reduce
|
||
|
#(let [c (count %2)]
|
||
|
(if (or (= 2 c) (= 3 c) (= 4 c) (= 7 c))
|
||
|
(inc %1)
|
||
|
%1
|
||
|
)
|
||
|
)
|
||
|
0
|
||
|
(subvec
|
||
|
(mapv (comp str/join sort) (str/split line #" "))
|
||
|
11 15
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
)
|
||
|
|