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.
for i in S:
if i.isalpha() and i.islower():
v.append(i)
elif i.isalpha() and i.isupper():
u.append(i)
elif i.isnumeric():
t.append(i)
v=sorted(v)
u=sorted(u)
t=sorted(t,key=lambda x:(int(x)%2==0,int(x)))
k=v+u+t
print("".join(k))
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 →
S=input().strip() v,u,t=[],[],[]
for i in S: if i.isalpha() and i.islower(): v.append(i) elif i.isalpha() and i.isupper(): u.append(i) elif i.isnumeric(): t.append(i)
v=sorted(v) u=sorted(u) t=sorted(t,key=lambda x:(int(x)%2==0,int(x))) k=v+u+t print("".join(k))