<>=~/B.*A(?{++$-})^/;print$-