ginortS in python – HackerRank Solution

ginortS in python - HackerRank Solution
ginortS in python – HackerRank Solution

You are given a string S.
S contains alphanumeric characters only.

astyAudBWwkbZ7EIdgPo3EvvNlqoiqmpR0mA61x4VmVwJelm2WNqVldCHMGME4eG3Bw=s0 d

Your task is to sort the string S in the following manner:

  • All sorted lowercase letters are ahead of uppercase letters.
  • All sorted uppercase letters are ahead of digits.
  • All sorted odd digits are ahead of sorted even digits.

Input Format :

A single line of input contains the string S.

Constraints :

  • 0 < len(S) < 1000

Output Format :

Output the sorted string S.


Sample Input :

Sorting1234

Sample Output :

ginortS1324



ginortS in python – HackerRank Solution

print(*sorted(input(), key=lambda c: (c.isdigit() - c.islower(), c in '02468', c)), sep='')

Disclaimer: The above Problem (ginortS in python – HackerRank Solution ) is generated by Hackerrank but the Solution is Provided by Chase2Learn. This tutorial is only for Educational and Learning purposes. Authority if any of the queries regarding this post or website fill the following contact form thank you.

Leave a Comment