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.
n = list(input())
n.sort()
lower, upper, odd, even = '', '', '', ''
for i in n:
if i.islower():
lower += i
elif i.isupper():
upper += i
elif i.isdigit() and int(i)%2 == 1:
odd += i
elif i.isdigit() and int(i)%2 == 0:
even += i
print(lower+upper+odd+even)
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 →
n = list(input()) n.sort() lower, upper, odd, even = '', '', '', '' for i in n: if i.islower(): lower += i elif i.isupper(): upper += i elif i.isdigit() and int(i)%2 == 1: odd += i elif i.isdigit() and int(i)%2 == 0: even += i print(lower+upper+odd+even)