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