尝试更改此:
if len(set(substr)) != (end - start): # found duplicates or EOS break if (ord(max(sorted(substr))) - ord(min(sorted(substr))) + 1) == len(substr):
对此:
if len(substr) != (end - start): # found duplicates or EOS break if sorted(substr) == list(substr):
这将显示
ccl您的示例输入字符串。代码更简单,因为您正试图解决一个更简单的问题:-)



