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.
string = input()
li = []
l1= []
l2 = []
l3 = []
for i in string:
if i.islower() == True:
li.append(i)
li.sort()
for i in string:
if i.isupper()==True:
l1.append(i)
l1.sort()
for i in string:
if i.isdigit() == True:
if float(i)%2 != 0:
l2.append(i)
l2.sort()
for i in string:
if i.isdigit() == True:
if float(i)%2 == 0:
l3.append(i)
l3.sort()
print(l2,l3)
last = (li+l1+l2+l3)
final = ''.join(last)
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 →
string = input() li = [] l1= [] l2 = [] l3 = [] for i in string: if i.islower() == True: li.append(i) li.sort() for i in string: if i.isupper()==True: l1.append(i) l1.sort() for i in string: if i.isdigit() == True: if float(i)%2 != 0: l2.append(i) l2.sort() for i in string: if i.isdigit() == True: if float(i)%2 == 0: l3.append(i) l3.sort()
print(l2,l3)
last = (li+l1+l2+l3) final = ''.join(last) print(final)