Hello Programmers, In this post, you will know how to solve the ginortS in python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.
One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.
ginortS in python Hacker Rank Solution
Problem
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 in python HackerRank Solutions
print(*sorted(input(), key=lambda c: (c.isdigit() - c.islower(), c in '02468', c)), sep='')
Disclaimer: The above Problem (ginortS in python ) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.