#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string s, t;
int dp1[1000 + 1][1000 + 1][10 + 1], dp2[1000 + 1][1000 + 1][10 + 1];
void compute1(int i, int j, int b) {
  dp1[i][j][b] = -1;
  if (b == 0) return;
  if (i == 0 || j == 0) {
    if (b <= 1) dp1[i][j][b] = (s[i] == t[j] ? 1 : -1);
  } else {
    if (s[i] == t[j]) {
      if (dp1[i - 1][j - 1][b] != -1) dp1[i][j][b] = 1 + dp1[i - 1][j - 1][b];
      if (dp2[i - 1][j - 1][b - 1] != -1)
        dp1[i][j][b] = max(dp1[i][j][b], 1 + dp2[i - 1][j - 1][b - 1]);
    }
  }
}
void compute2(int i, int j, int b) {
  dp2[i][j][b] = -1;
  if (b == 0) {
    dp2[i][j][b] = 0;
    return;
  }
  if (i == 0 && j == 0) {
    if (b <= 1) dp2[i][j][b] = (s[i] == t[j] ? 1 : -1);
  } else if (i != 0 && j == 0) {
    if (b <= 1) dp2[i][j][b] = (s[i] == t[j] ? 1 : dp2[i - 1][j][b]);
  } else if (i == 0 && j != 0) {
    if (b <= 1) dp2[i][j][b] = (s[i] == t[j] ? 1 : dp2[i][j - 1][b]);
  } else {
    if (i != 0) dp2[i][j][b] = max(dp2[i][j][b], dp2[i - 1][j][b]);
    if (j != 0) dp2[i][j][b] = max(dp2[i][j][b], dp2[i][j - 1][b]);
    if (s[i] == t[j]) {
      if (dp2[i - 1][j - 1][b - 1] != -1)
        dp2[i][j][b] = max(dp2[i][j][b], 1 + dp2[i - 1][j - 1][b - 1]);
      if (dp1[i - 1][j - 1][b] != -1)
        dp2[i][j][b] = max(dp2[i][j][b], 1 + dp1[i - 1][j - 1][b]);
    }
  }
}
int solve() {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int b = 0; b <= k; b++) {
        compute1(i, j, b);
        compute2(i, j, b);
      }
    }
  }
  return dp2[n - 1][m - 1][k];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  cin >> s >> t;
  cout << solve() << '\n';
  return 0;
}
