print w="$System.in"-'\n' i=n=w.count w.any{c->print"$c\n"+w[--i]+(i?' '*~-n:w[-1..0])}