RosettaCodeData/Task/Rep-string/BaCon/rep-string.bacon

18 lines
438 B
Plaintext

all$ = "1001110011 1110111011 0010010010 1010101010 1111111111 0100101101 0100100 101 11 00 1"
FOR word$ IN all$
FOR x = LEN(word$)/2 DOWNTO 1
ex$ = EXPLODE$(word$, x)
FOR st$ IN UNIQ$(ex$)
IF NOT(REGEX(HEAD$(ex$, 1), "^" & st$)) THEN CONTINUE 2
NEXT
PRINT "Repeating string: ", word$, " -> ", HEAD$(ex$, 1)
CONTINUE 2
NEXT
PRINT "Not a repeating string: ", word$
NEXT