## Algorithm

Problem Name: Python - ginortS

In this HackerRank Functions in PYTHON problem solution,

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
``````

## Code Examples

### #1 Code Example with Python Programming

```Code - Python Programming```

``````
s = input()
lower = sorted([i for i in s if i.islower()])
upper = sorted([i for i in s if i.isupper()])
odd = sorted([i for i in s if i.isdigit() and int(i) % 2 != 0])
even = sorted([i for i in s if i.isdigit() and int(i) % 2 == 0])
print(''.join(lower + upper + odd + even))
``````
Copy The Code &