提交时间:2024-01-29 19:37:49

运行 ID: 234746

#include <iostream> using namespace std; int clac(string a, string b) { int res(0); for (int i = 0; i < a.size(); i++) { res += a[i] == b[i]; } return res; } int main() { int n, ans(0); string s, t; cin >> n >> s >> t; for (int i = 1; i < t.size(); i++) { for (int j = 0; j < i; j++) { string nt(t); swap(nt[i], nt[j]); ans = max(ans, clac(s, nt)); } } cout << ans; }