{"raw_statement":[{"iden":"problem statement","content":"You are given two strings $S$ and $T$ of length $N$ consisting of `A` and `B`. Let $S_i$ denote the $i$\\-th character from the left of $S$.\nYou can repeat the following operation any number of times, possibly zero:\n\n*   Choose integers $i$ and $j$ such that $1\\leq i < j \\leq N$. Replace $S_i$ with `A` and $S_j$ with `B`.\n\nDetermine if it is possible to make $S$ equal $T$. If it is possible, find the minimum number of operations required."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   Each of $S$ and $T$ is a string of length $N$ consisting of `A` and `B`.\n*   All input numbers are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$S$\n$T$"},{"iden":"sample input 1","content":"5\nBAABA\nAABAB"},{"iden":"sample output 1","content":"2\n\nPerforming the operation with $i=1$ and $j=3$ changes $S$ to `AABBA`.\nPerforming the operation with $i=4$ and $j=5$ changes $S$ to `AABAB`.\nThus, you can make $S$ equal $T$ with two operations. It can be proved that this is the minimum number of operations required, so the answer is $2$."},{"iden":"sample input 2","content":"2\nAB\nBA"},{"iden":"sample output 2","content":"\\-1\n\nIt can be proved that no matter how many operations you perform, you cannot make $S$ equal $T$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}