#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() #define dunk(a) cout << (a) << endl using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; string S, T; cin >> S >> T;//A->muji B->gara int Sa, Sb, Ta, Tb; Sa = count(all(S), 'A'); Sb = count(all(S), 'B'); Ta = count(all(T), 'A'); Tb = count(all(T), 'B'); int ans = min(Sa, Ta) + min(Sb, Tb); dunk(ans); return 0; }