$\+=/c/*($w+=/w/)*~-$w/2for$/=\1,reverse<>;print