Searching for repeated characters in a sequence of characters
I'd start bottom-up on this one if you want to do it in a slightly more idiomatic / functional style. Also it's good to get the data in Clojure sequences rather than strings as it makes it a bit easier to manipulate.

You're trying to work on groups of five adjacent characters so I'd set up a sequence of such adjacent groups:

; define some source data, right answer is "1235"
(def char-seq (seq "dfyfgvbufi12345idvdfhopshbsopgeobvufpdhbugphp123a5ghauoyhewqojbvrbon"))

; now partition into adjacent overlapping groups of five (with a step of 1)
(def char-groups (partition 5 1 char-seq))

; prove it works
(take 3 char-groups)
=&gt; ((\d \f \y \f \g) (\f \y \f \g \v) (\y \f \g \v \b))


Now we want to define what a valid match means: in this case 4 characters should be the same in two groups being compared. 

; helper function to count the number of true values in a collection / sequence
(defn count-true [coll]
  (reduce 
    #(+ %1 (if %2 1 0))
    0 
    coll))

; function to determine if exactly four characters are equal in two groups
(defn matches? [group1 group2]
  (= 4
    (count-true (map = group1 group2))))


Finally you just need to run the matches? function over all possible groups:

(def results
  (distinct
    (keep identity
      (for [group1 char-groups 
            group2 char-groups]
        (if (matches? group1 group2)
          (filter identity (map #(if (= %1 %2) %1 nil) group1 group2))
          nil)))))


results
=&gt; ((\1 \2 \3 \5))