func main() var n: int :: cui@inputInt() var m: int :: cui@inputInt() var s: []char :: cui@input() var t: []char :: cui@input() var sa: int :: 0 for i(0, n - 1) if(s[i] = 'A') do sa :+ 1 end if end for var ta: int :: 0 for i(0, m - 1) if(t[i] = 'A') do ta :+ 1 end if end for var ans: int :: [sa, ta].min() + [n - sa, m - ta].min() do cui@print("\{ans}\n") end func