$_&&push@y,$_ for split/(.)\1*/,<>;for$p(0..1<<$#y){print$p&(1<<$#y-$_-1)?$y[$_]:''for 0..$#y;print' '}