Skip to content

Instantly share code, notes, and snippets.

@glickmac
Created September 9, 2022 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glickmac/0f5bcd0a76d4913f7fbab1d46ac8d026 to your computer and use it in GitHub Desktop.
Save glickmac/0f5bcd0a76d4913f7fbab1d46ac8d026 to your computer and use it in GitHub Desktop.
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))
@glickmac
Copy link
Author

glickmac commented Sep 9, 2022

Created code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment