#!/usr/bin/perl -ause 5.10.0;@a=($F[-1]-$b?$b:2*pop@F,@a)while$b=pop@F;say"@a"
3 3 3 1 1 7 5 5 5 5
3 6 2 7 10 10
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!