This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # Factor a string into nonincreasing Lyndon words, | |
| # using Duval's algorithm | |
| def lyndonFactor(s): | |
| k = 0 | |
| ret = [] | |
| while k < len(s): | |
| i = k | |
| j = i + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| weird: | |
| ...-emoticon: | |
| ...-emoticon-frowning-face: 囧 | |
| ...-emoticon-frowning-king: 崮 | |
| ...-emoticon-frowning-queen: 莔 | |
| ...-emoticon-frowning-withhat: 商 | |
| ...-emoticon-frowning-turtle: 囧興 | |
| ...-emoticon-bomberman: 卣 | |
| ...-emoticon-verydull: 槑 | |
| ...-arbitrary: 𠖬𠄓𠔇𦫺𦫷𦫻𠄑𠦑𠅂𢀗𠃟𨱘𠇬𥎨𠛷𠃡𡭡𡉵𠮸𠅑 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def gcd(a, b): | |
| a = abs(a) | |
| b = abs(b) | |
| while a: | |
| a, b = b % a, a | |
| return b |