#include <bits/stdc++.h>   using namespace std;   long long solve() {     long long m, n, i, j;     string a, b;     cin >> m >> n >> a >> b;     long long t[m + 1][n + 1];     memset(t, 0, sizeof(t));     long long sol = 0;     for (i = 1; i <= m; i++)       for (j = 1; j <= n; j++) {         if (a[i - 1] == b[j - 1])           t[i][j] = 2 + t[i - 1][j - 1];         else           t[i][j] = max(t[i - 1][j], t[i][j - 1]) - 1;         t[i][j] = max((long long)0, t[i][j]);         sol = max(sol, t[i][j]);       }     return sol;   }   int32_t main() {     long long t = 1;     while (t--) cout << solve() << endl;     return 0;   }   