Skip to content

Instantly share code, notes, and snippets.

@glickmac
Created September 9, 2022 14:38
Show Gist options
  • Select an option

  • Save glickmac/0f5bcd0a76d4913f7fbab1d46ac8d026 to your computer and use it in GitHub Desktop.

Select an option

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

glickmac commented Sep 9, 2022

Copy link
Copy Markdown
Author

Created code

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