src/problems/subs.lisp @ ad32169fc54c
TREE
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 20 Dec 2019 16:23:36 -0500 |
parents |
c26fa4d063ba |
children |
2735aa6aab79 |
(in-package :rosalind)
(defparameter *input-subs* "GATATATGCATATACTT
ATAT")
(defparameter *output-subs* "2 4 10")
(define-problem subs (data stream)
*input-subs*
*output-subs*
(let ((haystack (read-line data))
(needle (read-line data)))
(iterate
(for pos :seed -1 :then (search needle haystack :start2 (1+ pos)))
(while pos)
(collect (1+ pos) :into result)
(finally (return (str:join " " result))))))