Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Data.List
f z q=concat$replicate(length z)q
main=interact(\z->minimum$filter(\q->isInfixOf z$f z q)$sort$filter(not.null)$inits=<<tails z)
-- Original version in 91 chars.
import Data.List
main=interact(\z->minimum$filter(\q->isInfixOf z$q++q++q)$inits=<<tails z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment