I have tested George's solutions, it seems not complete. When pass (s, 3) to the function hasConsequent(), it returns the wrong result.
The following is my approach. The performence may be not so good. There must be better ones. >>> from re import findall >>> def hasConsequent(aString, minConsequent): for ch in aString: result = findall(ch*minConsequent, aString) if len(result) >= 1: return True return False >>> hasConsequent(s, 2) True >>> hasConsequent(s, 3) True >>> hasConsequent(s, 4) False Aries Sun -- http://mail.python.org/mailman/listinfo/python-list