#include <bits/stdc++.h>
using namespace std;
int dp[1010][1010][12][2];
char str[2][1010];
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", str[0], str[1]);
  memset(dp, -1, sizeof(dp));
  dp[0][0][0][0] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      if (i == n && j == m) break;
      for (int r = 0; r <= k; r++) {
        if (dp[i][j][r][0] == -1 && dp[i][j][r][1] == -1) continue;
        if (j == m) {
          dp[i + 1][j][r][0] =
              max(dp[i + 1][j][r][0], max(dp[i][j][r][0], dp[i][j][r][1]));
          continue;
        }
        if (i == n) {
          dp[i][j + 1][r][0] =
              max(dp[i][j + 1][r][0], max(dp[i][j][r][0], dp[i][j][r][1]));
          continue;
        }
        if (dp[i][j][r][0] != -1) {
          if (str[0][i] == str[1][j]) {
            dp[i + 1][j + 1][r + 1][1] =
                max(dp[i + 1][j + 1][r + 1][1], dp[i][j][r][0] + 1);
          }
          int re = max(dp[i][j][r][1], dp[i][j][r][0]);
          dp[i + 1][j + 1][r][0] = max(dp[i + 1][j + 1][r][0], re);
          dp[i + 1][j][r][0] = max(dp[i + 1][j][r][0], re);
          dp[i][j + 1][r][0] = max(dp[i][j + 1][r][0], re);
        }
        if (dp[i][j][r][1] != -1) {
          if (str[0][i] == str[1][j]) {
            dp[i + 1][j + 1][r][1] =
                max(dp[i + 1][j + 1][r][1], dp[i][j][r][1] + 1);
            dp[i + 1][j + 1][r + 1][1] =
                max(dp[i + 1][j + 1][r + 1][1], dp[i][j][r][1] + 1);
            dp[i + 1][j + 1][r + 1][1] =
                max(dp[i + 1][j + 1][r + 1][1], dp[i][j][r][0] + 1);
          }
          int re = max(dp[i][j][r][1], dp[i][j][r][0]);
          dp[i + 1][j + 1][r][0] = max(dp[i + 1][j + 1][r][0], re);
          dp[i + 1][j][r][0] = max(dp[i + 1][j][r][0], re);
          dp[i][j + 1][r][0] = max(dp[i][j + 1][r][0], re);
        }
      }
    }
  }
  printf("%d\n", max(dp[n][m][k][0], dp[n][m][k][1]));
  return 0;
}
