AT_abc447_c [ABC447C] Insert and Erase A

Description

You are given strings $ S $ and $ T $ consisting of uppercase English letters. You may perform the following two types of operations any number of times (possibly zero) in any order: - Insert one character `A` at any position in $ S $ (possibly the beginning or the end). - Choose one character `A` in $ S $ and delete it. The remaining characters are concatenated in their original order. Determine whether it is possible to make $ S $ equal to $ T $ , and if so, find the minimum total number of operations required.

Input Format

The input is given from Standard Input in the following format: >$S$ $T$

Output Format

If it is possible to make $ S $ equal to $ T $ , output the minimum total number of operations required; otherwise, output `-1`.

Explanation/Hint

### Sample Explanation 1 It is possible to make $ S $ equal to $ T $ in three operations in total, as follows: - Insert one `A` between the second and third characters of $ S $ . Now, $ S= $ `ABAC`. - Delete the first character of $ S $ , which is `A`. Now, $ S= $ `BAC`. - Insert one `A` at the end of $ S $ . Now, $ S= $ `BACA`. It is impossible to make $ S $ equal to $ T $ in two or fewer operations, so the answer is $ 3 $ . ### Sample Explanation 2 No matter how operations are performed, it is impossible to make $ S $ equal to $ T $ . ### Sample Explanation 3 No operations need to be performed. ### Constraints - $ S $ and $ T $ are strings of uppercase English letters with length between $ 1 $ and $ 3\times 10^5 $ , inclusive.