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.
lowercase = sorted([c for c in s if c.islower()])
uppercase = sorted([c for c in s if c.isupper()])
odd = sorted([c for c in s if c.isdigit() and int(c)%2 !=0])
even = sorted([c for c in s if c.isdigit() and int(c)%2 ==0])
s = input()
lowercase = sorted([c for c in s if c.islower()]) uppercase = sorted([c for c in s if c.isupper()]) odd = sorted([c for c in s if c.isdigit() and int(c)%2 !=0]) even = sorted([c for c in s if c.isdigit() and int(c)%2 ==0])
sorted_s = ''.join(lowercase+uppercase+odd+even) print(sorted_s)
name = input() sorted_data = ''.join(sorted(name,key=lambda x:( x.isdigit(), x.isdigit() and int(x)%2==0, x.isupper(), x ))) print(sorted_data)
That's it