Created
April 14, 2020 10:27
-
-
Save AnBucquet/c3d9cd6959c091df66432b4c7be409f3 to your computer and use it in GitHub Desktop.
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
| # Solution one | |
| a='AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz' | |
| t=input().replace(' ','') | |
| x = [c for c in t if not c.isalpha()] | |
| b = [c for c in t if c.isalpha()] | |
| s = sorted(b,key=lambda c:a.index(c)) | |
| # Write an answer using print | |
| # To debug: print("Debug messages...", file=sys.stderr) | |
| print(''.join(s)+''.join(x)) | |
| # Solution two | |
| entry = input().replace(" ","") | |
| order = sorted(set(entry.lower())) | |
| t="" | |
| for l in order: | |
| if l.isalpha(): | |
| t+=(l.upper())*entry.count(l.upper())+(l)*entry.count(l) | |
| for l in entry: | |
| if not l.isalpha(): | |
| t+=l | |
| print(t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment