#include <bits/stdc++.h>
using namespace std;
const int N = 1001, K = 11;
int n, m, k, dp[N][N][K][2];
char a[N], b[N];
int calc(int i, int j, int k, int o) {
  if (k == 0) return 0;
  if (i == n || j == m) return -1e9;
  int &r = dp[i][j][k][o];
  if (r != -1) return r;
  if (a[i] == b[j])
    r = max(r, max(calc(i + 1, j + 1, k - 1, 0), calc(i + 1, j + 1, k, 1)) + 1);
  r = max(r, max(calc(i + 1, j, (o ? k - 1 : k), 0),
                 calc(i, j + 1, (o ? k - 1 : k), 0)));
  return r;
}
int main() {
  std::ios::sync_with_stdio(false);
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", a, b);
  memset(dp, 0, sizeof(dp));
  for (int l = 1; l <= k; l++) dp[n][n][l][0] = dp[n][m][l][1] = -1e9;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      for (int l = 1; l <= k; l++) {
        for (int o = 0; o <= 1; o++) {
          if (a[i] == b[j])
            dp[i][j][l][o] = max(
                dp[i][j][l][o],
                max(dp[i + 1][j + 1][l][1], dp[i + 1][j + 1][l - 1][0]) + 1);
          dp[i][j][l][o] =
              max(dp[i][j][l][o], max(dp[i + 1][j][o ? l - 1 : l][0],
                                      dp[i][j + 1][o ? l - 1 : l][0]));
        }
      }
    }
  }
  printf("%d\n", dp[0][0][k][0]);
  return 0;
}
