Skip to content

Instantly share code, notes, and snippets.

@codeperfectplus
Created September 15, 2023 14:52
Show Gist options
  • Save codeperfectplus/58f18e350c71d685734673231547edf8 to your computer and use it in GitHub Desktop.
Save codeperfectplus/58f18e350c71d685734673231547edf8 to your computer and use it in GitHub Desktop.
import string
def ginortS(input_string):
small = ""
capital = ""
odd = ""
even = ""
for i in input_string:
if i in string.ascii_lowercase:
small += i
elif i in string.ascii_uppercase:
capital += i
elif int(i) % 2 == 0:
even += i
else:
odd += i
final = sorted(small) + sorted(capital) + sorted(odd) + sorted(even)
return "".join(final)
if __name__ == '__main__':
input_string = input()
print(ginortS(input_string))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment