You are viewing a single comment's thread. Return to all comments →
S = str(input())
upper = '' lower = '' num = ''
for i in range(len(S)): if S[i].isupper(): upper += S[i] elif S[i].islower(): lower += S[i] else: num += S[i]
odd = [i for i in num if int(i) % 2 != 0] even = [i for i in num if int(i) % 2 == 0]
sorted_upper = ''.join(sorted(upper)) sorted_lower = ''.join(sorted(lower)) sorted_odd = ''.join(sorted(odd)) sorted_even = ''.join(sorted(even))
print(f"{sorted_lower}{sorted_upper}{sorted_odd}{sorted_even}")
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 →
Enter your code here. Read input from STDIN. Print output to STDOUT
S = str(input())
upper = '' lower = '' num = ''
for i in range(len(S)): if S[i].isupper(): upper += S[i] elif S[i].islower(): lower += S[i] else: num += S[i]
odd = [i for i in num if int(i) % 2 != 0] even = [i for i in num if int(i) % 2 == 0]
sorted_upper = ''.join(sorted(upper)) sorted_lower = ''.join(sorted(lower)) sorted_odd = ''.join(sorted(odd)) sorted_even = ''.join(sorted(even))
print(f"{sorted_lower}{sorted_upper}{sorted_odd}{sorted_even}")