Lyndon word: Difference between revisions

m
m (→‎{{header|jq}}: assumption)
Line 33:
.
x$[] = strchars substr x$ 1 n
while len x$[] > 0 and x$[-1len x$[]] = alpha$[-1len alpha$[]]
len x$[] -1
.
iflx = len x$[] > 0
if lx > 0
repeat
i += 1
until alpha$[i] = x$[-1lx]
.
x$[-1lx] = alpha$[i + 1]
.
return strjoin x$[]
2,063

edits