#include <bits/stdc++.h>
int lcs[1005][1005];
char a[1005], b[1005];
int n, m, k;
int dp[1005][1005][15];
int max(int a, int b) {
  if (a >= b) return a;
  return b;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", &a, &b);
  int i, j, l;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i - 1] == b[j - 1]) lcs[i][j] = 1 + lcs[i - 1][j - 1];
    }
  }
  int ans = 0;
  for (l = 1; l <= k; l++) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        int fir = dp[i - lcs[i][j]][j - lcs[i][j]][l - 1] + lcs[i][j];
        int sec = max(dp[i][j - 1][l], dp[i - 1][j][l]);
        dp[i][j][l] = max(fir, sec);
        if (dp[i][j][l] > ans) ans = dp[i][j][l];
      }
    }
  }
  printf("%d\n", dp[n][m][k]);
}
