data = ['30000', '2300', '9000', '10000', '1500', '300', '25', '1222']
list_zero = [[], [], [], [], []]
def zero(a, b):
list_zero[4-a].append(b)
return list_zero
for i in data:
a = len(i)-len(str(int(i[::-1])))
zero(a, i)
for k in list_zero:
if k: print(*sorted(k, key=int, reverse=True), end = ' ')