{"problem":{"name":"Yet Another AB Problem","description":{"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$. You can repeat the following operation any number of times, ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc170_a"},"statements":[{"statement_type":"Markdown","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.\n\n## Constraints\n\n*   $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.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$S$\n$T$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc170_a","tags":[],"sample_group":[["5\nBAABA\nAABAB","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$."],["2\nAB\nBA","\\-1\n\nIt can be proved that no matter how many operations you perform, you cannot make $S$ equal $T$."]],"created_at":"2026-03-03 11:01:14"}}