Skip to main content
added 33 characters in body
Source Link

Python 3, 98 bytes

lambda s,e=enumerate:[s[i-n:i]for i,n in e([9]+s)if all(m!=j+1form+~j for j,m in e(s[i-n:i-1]))and 0<n<=i]>0<n<=i]

Try it online!Try it online!

Takes the input as a list and maps it to a list of lists where each item is a sublist of length n ending with item n for each item. Then it is filtered so that no list contains other valid length terminators.

-4 bytes thanks to Jonathan Frech

Python 3, 98 bytes

lambda s,e=enumerate:[s[i-n:i]for i,n in e([9]+s)if all(m!=j+1for j,m in e(s[i-n:i-1]))and 0<n<=i]

Try it online!

Takes the input as a list and maps it to a list of lists where each item is a sublist of length n ending with item n for each item. Then it is filtered so that no list contains other valid length terminators.

Python 3, 98 bytes

lambda s,e=enumerate:[s[i-n:i]for i,n in e([9]+s)if all(m+~j for j,m in e(s[i-n:i-1]))>0<n<=i]

Try it online!

Takes the input as a list and maps it to a list of lists where each item is a sublist of length n ending with item n for each item. Then it is filtered so that no list contains other valid length terminators.

-4 bytes thanks to Jonathan Frech

Source Link

Python 3, 98 bytes

lambda s,e=enumerate:[s[i-n:i]for i,n in e([9]+s)if all(m!=j+1for j,m in e(s[i-n:i-1]))and 0<n<=i]

Try it online!

Takes the input as a list and maps it to a list of lists where each item is a sublist of length n ending with item n for each item. Then it is filtered so that no list contains other valid length terminators.