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.
if name == "main":
intput_ = input()
evenumbers = sorted([ ch for ch in intput_ if ch.isdigit() and int(ch)%2==0])
oddnumbers = sorted([ ch for ch in intput_ if ch.isdigit() and int(ch)%2!=0])
capital = sorted([ch for ch in intput_ if ch.isupper()])
letters = sorted([ch for ch in intput_ if ch.isalpha() and ch.islower()])
final = "".join(letters)+"".join(capital)+"".join(oddnumbers)+"".join(evenumbers)
print(final)
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 →
if name == "main": intput_ = input() evenumbers = sorted([ ch for ch in intput_ if ch.isdigit() and int(ch)%2==0]) oddnumbers = sorted([ ch for ch in intput_ if ch.isdigit() and int(ch)%2!=0]) capital = sorted([ch for ch in intput_ if ch.isupper()]) letters = sorted([ch for ch in intput_ if ch.isalpha() and ch.islower()]) final = "".join(letters)+"".join(capital)+"".join(oddnumbers)+"".join(evenumbers) print(final)