# Pyth, 31 bytes Js[K\#*d+2lzKb*K+4lz)_Jjd[KzK)J Thanks to people in comments giving hints on how to golf further, I really don't know the language well as you can (probably) tell.