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