(compile(defun f(n c)(dotimes(i(1+ n))(setf m 99 k()(elt a i)(if(find i c)(list i)(doseq(x c(if k`(,k,@(elt a(- i k)))))(and(>= i x)#1=(elt a(- i x))(< #2=(length #1#)m)(setf m #2#k x))))))(or(aref a n)'(-))))(loop(setf x(read-from-string(delete #\:(format()"(~A)"(read-line))))a(make-array(1+(car x))))(format t"~{~A~^ ~} "(f(pop x)x)))