#Perl 5, (33 Bytes+2) = 35 A regex-less solution. map{print$p=$_.$"if$_>=$p||!$p}@F ### Test *Note that the @F array is populated because of the -a switch.* $ echo -7 -8 -5 0 -1 4 4 3 5|perl -na -e 'map{print$p=$_.$"if$_>=$p||!$p}@F' -7 -5 0 4 4 5