10 of 13 oops... $'$not $$'

# Perl 5, 42 bytes

40 bytes plus two for the -lF flags (-M5.01 is free): perl -lF -M5.01 script.pl

/#+/;map{unshift@F,pop@F}1.."$'$";say@F


Explanation:

• -lF reads the input, removes the trailing newline, puts the remainder into the string $_, splits it up into characters, and puts that split into the array @F. • /#+/ finds #s in $_ and sets $ equal to the stuff before it and $' equal to the stuff after it. "$'$" is thus the number of times to rotate the array.
• Now for every element of the list from 1 to "$'$", we rotate the array (pop the last element and unshift it onto the beginning).
• After the loop exits, we say all the elements of the rotated array.
 answered Feb 25 '16 at 17:10 msh210 3,0841515 silver badges3434 bronze badges