#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; string S, T; cin >> S >> T; map mp; for (auto s : S) { mp[s]++; } int res = 0; for (auto t : T) { if (mp[t] > 0) { res++; mp[t]--; } } cout << res << '\n'; return 0; }