We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
p = input()
low = sorted([x for x in p if x.islower()])
uper = sorted([x for x in p if x.isupper()])
di = sorted([x for x in p if x.isdigit()])
digit = sorted([x for x in di if x.isdigit()], key=lambda x : int(x)%2 == 0)
print("".join(low + uper + digit))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
ginortS
You are viewing a single comment's thread. Return to all comments →
p = input() low = sorted([x for x in p if x.islower()]) uper = sorted([x for x in p if x.isupper()]) di = sorted([x for x in p if x.isdigit()]) digit = sorted([x for x in di if x.isdigit()], key=lambda x : int(x)%2 == 0) print("".join(low + uper + digit))