fork(1) download
  1. o=t=[];a=input()
  2. for i in a:
  3. if i%2:t=[i]+t
  4. else:o+=t+[i];t=[]
  5. print(o+t)
Success #stdin #stdout 0.01s 9016KB
stdin
[123,123,345,0,1,9]
stdout
[345, 123, 123, 0, 9, 1]