#include <bits/stdc++.h>
using namespace std;
int a, s, d[1004][1004][13][2], f, g, h, j, k, l, i, n, m;
string x, z;
int main() {
  cin >> n >> m >> k;
  cin >> x >> z;
  x = x + " ";
  z = z + " ";
  for (i = 0; i <= n; i++) {
    for (a = 0; a <= m; a++) {
      for (j = 0; j <= k; j++) {
        if (x[i] == z[a]) {
          d[i + 1][a + 1][j + 1][1] =
              max(d[i + 1][a + 1][j + 1][1], d[i][a][j][0] + 1);
          if (min(i, a) > 0 && x[i - 1] == z[a - 1] && d[i][a][j][1]) {
            d[i + 1][a + 1][j][1] =
                max(d[i + 1][a + 1][j][1], d[i][a][j][1] + 1);
          }
        }
        d[i + 1][a][j][0] = max(d[i + 1][a][j][0], d[i][a][j][0]);
        d[i + 1][a][j][0] = max(d[i + 1][a][j][0], d[i][a][j][1]);
        d[i][a + 1][j][0] = max(d[i][a + 1][j][0], d[i][a][j][0]);
        d[i][a + 1][j][0] = max(d[i][a + 1][j][0], d[i][a][j][1]);
      }
    }
  }
  for (i = 0; i <= k; i++) {
    h = max(h, max(d[n][m][i][0], d[n][m][i][1]));
  }
  cout << h << endl;
}
