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

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 Hacker Rank Solution in python 2

def f(ch):
res = ord(ch)
if 65 <= res <= 90:
res += 100
elif res <= 57:
res += 200
if res % 2 == 0:
res += 10
return res
S = raw_input().strip()
print reduce(lambda x,y: x + y, sorted(S, key=f), '')

# Enter your code here. Read input from STDIN. Print output to STDOUT
from string import ascii_lowercase, ascii_uppercase, ascii_letters
sortkey = ascii_letters + "1357902468"
print reduce(lambda x,y: x+y, sorted(raw_input(),key=sortkey.index))

ginortS Hacker Rank Solution in pypy 3

# Enter your code here. Read input from STDIN. Print output to STDOUT
s = sorted(input())
lower = list(filter(lambda x: x.islower(),s))
upper = list(filter(lambda x: x.isupper(),s))
odd = list(filter(lambda x: x.isdigit() and int(x)%2 ==1, s))
even = list (filter(lambda x: x.isdigit() and int(x)%2 ==0,s))
print(*(lower + upper+odd+even), sep = "")

ginortS Hacker Rank Solution Review:

In our experience, we suggest you solve this ginortS Hacker Rank Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

ginortSis available on Hacker Rank for Free, if you are stuck anywhere between compilation, just visit Queslers to get all Hacker Rank Solution

ginortS Hacker Rank Solution Conclusion:

I hope this ginortS Hacker Rank Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Hacker Rank, Leetcode, Codechef, Codeforce Solution.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.