ginortS HackerRank Solution In Python

Problem

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.

Constraints

  • 0 < len(S) < 1000

Output Format

Output the sorted string S.

Sample Input

Sorting1234

Sample Output

ginortS1324

Solution – ginortS In Python | HackerRank

import strings = string.ascii_letters+'1357902468'print(''.join(sorted(input(), key=s.index)))

NOTE: The problem solved above, ginortS, was generated by HackerRank and the solution was brought by the admin of  CodingSolutions for educational purpose. Got any issues with the code? Ask your questions in the comment box and I shall attend to it.

Comments