Created
September 9, 2022 14:38
-
-
Save glickmac/0f5bcd0a76d4913f7fbab1d46ac8d026 to your computer and use it in GitHub Desktop.
This file contains 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
a = input() | |
words = list(a) | |
bwt = [] | |
for i in range(len(words)): | |
word = a[-1] + a[:-1] | |
new = ''.join(word) | |
a = new | |
bwt.append(new) | |
i += 1 | |
sort = sorted(bwt) | |
print(sort) | |
output = [] | |
for i in range(len(words)): | |
element = sort[i] | |
last = element[-1] | |
i = i + 1 | |
output.append(last) | |
print("".join(output)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Created code