Hackerrank - ginortS Solution
1 min read

Hackerrank - ginortS Solution

Hackerrank - ginortS Solution

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

Your task is to sort the string  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 .


Output Format

Output the sorted string .

Sample Input


Sample Output


Solution in Python

Using regex

import re
S= input()
print("".join(map(lambda x: "".join(sorted(re.findall(x, S))),series)))

Without regex

for i in sorted(input()):
    if i.isalpha():
        x = u if i.isupper() else l
        x = o if int(i)%2 else e

Enjoying these posts? Subscribe for more

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

That's okay. But without advertising-income, we can't keep making this site awesome.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add thepoorcoder.com to your ad blocking whitelist or disable your adblocking software.