Unnamed
public ruby v1 · immutable def find_smallest_n(i : Int, s : Iterator[Char]) = { val dna_i = dna drop (i + 1); val postfix = s.toList var n = i - 1; def find_n(d : Iterator[Char]) : Unit = { d dropWhile { a => n += 1; a != postfix(0) } if (!(d.buffered startsWith postfix)) { n += 1 find_n(d drop 1) } } find_n(dna_i) if (n == i - 1 || !(dna hasNext)) None else Some(n) }