RosettaCodeData/Task/Rep-string/11l/rep-string.11l

19 lines
325 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
F reps(text)
R (1 .< 1 + text.len I/ 2).filter(x -> @text.starts_with(@text[x..])).map(x -> @text[0 .< x])
V matchstr =
|1001110011
1110111011
0010010010
1010101010
1111111111
0100101101
0100100
101
11
00
1
L(line) matchstr.split("\n")
print('#.' has reps #..format(line, reps(line)))