(s,n)
Generate Lyndon words of length exactly n over an s-symbol alphabet.
    Since nearly half of the outputs of LengthLimitedLyndonWords(s,n)
    have the desired length, it again takes constant average time per word.
Generate Lyndon words of length exactly n over an s-symbol alphabet.
    Since nearly half of the outputs of LengthLimitedLyndonWords(s,n)
    have the desired length, it again takes constant average time per word.
Generate Lyndon words of length exactly n over an s - symbol alphabet . Since nearly half of the outputs of LengthLimitedLyndonWords ( s n ) have the desired length it again takes constant average time per word .
def LyndonWordsWithLength(s,n):
    """Generate Lyndon words of length exactly n over an s-symbol alphabet.
    Since nearly half of the outputs of LengthLimitedLyndonWords(s,n)
    have the desired length, it again takes constant average time per word."""
    if n == 0:
        yield []    # the empty word is a special case not handled by main alg
    for w in LengthLimitedLyndonWords(s,n):
        if len(w) == n:
            yield w
def LyndonWordsWithLength ( s , n ) : if n == 0 : yield [ ] # the empty word is a special case not handled by main alg for w in LengthLimitedLyndonWords ( s , n ) : if len ( w ) == n : yield w