(s)
Find starting positions of Chen-Fox-Lyndon decomposition of s.
    The decomposition is a set of Lyndon words that start at 0 and
    continue until the next position. 0 itself is not output, but
    the final breakpoint at the end of s is. The argument s must be
    of a type that can be indexed (e.g. a list, tuple, or string).
    The algorithm follows Duval, J. Algorithms 1983, but uses 0-based
    indexing rather than Duval's choice of 1-based indexing.
Find starting positions of Chen-Fox-Lyndon decomposition of s.
    The decomposition is a set of Lyndon words that start at 0 and
    continue until the next position. 0 itself is not output, but
    the final breakpoint at the end of s is. The argument s must be
    of a type that can be indexed (e.g. a list, tuple, or string).
    The algorithm follows Duval, J. Algorithms 1983, but uses 0-based
    indexing rather than Duval's choice of 1-based indexing.
Find starting positions of Chen - Fox - Lyndon decomposition of s . The decomposition is a set of Lyndon words that start at 0 and continue until the next position . 0 itself is not output but the final breakpoint at the end of s is . The argument s must be of a type that can be indexed ( e . g . a list tuple or string ) . The algorithm follows Duval J . Algorithms 1983 but uses 0 - based indexing rather than Duval s choice of 1 - based indexing .
def ChenFoxLyndonBreakpoints(s):
    """Find starting positions of Chen-Fox-Lyndon decomposition of s.
    The decomposition is a set of Lyndon words that start at 0 and
    continue until the next position. 0 itself is not output, but
    the final breakpoint at the end of s is. The argument s must be
    of a type that can be indexed (e.g. a list, tuple, or string).
    The algorithm follows Duval, J. Algorithms 1983, but uses 0-based
    indexing rather than Duval's choice of 1-based indexing."""
    k = 0
    while k < len(s):
        i,j = k,k+1
        while j < len(s) and s[i] <= s[j]:
            i = (s[i] == s[j]) and i+1 or k     # Python cond?yes:no syntax
            j += 1
        while k < i+1:
            k += j-i
            yield k
def ChenFoxLyndonBreakpoints ( s ) : k = 0 while k < len ( s ) : i , j = k , k + 1 while j < len ( s ) and s [ i ] <= s [ j ] : i = ( s [ i ] == s [ j ] ) and i + 1 or k # Python cond?yes:no syntax j += 1 while k < i + 1 : k += j - i yield k