<>=~s#|.#$a[2*y!!!+$|--]=0for$'^reverse$`#ger;print$#a