#include <bits/stdc++.h>
int n, m, x, tab[11][1001][1001], mx[11][1001][1001], i = 1, j = 1, ij = 1;
char a[1001], b[1001], q;
inline int max(int a, int b) {
  if (a >= b) return a;
  return b;
}
int main() {
  scanf("%d %d %d", &n, &m, &x);
  q = getchar();
  while (i <= n) {
    a[i] = getchar();
    i++;
  }
  q = getchar();
  i = 1;
  while (i <= m) {
    b[i] = getchar();
    i++;
  }
  i = 1;
  while (ij <= x) {
    while (i <= n) {
      while (j <= m) {
        if (a[i] == b[j])
          tab[ij][i][j] =
              max(tab[ij][i - 1][j - 1] + 1, mx[ij - 1][i - 1][j - 1] + 1);
        else
          tab[ij][i][j] = 0;
        mx[ij][i][j] = max(mx[ij][i - 1][j], mx[ij][i][j - 1]);
        mx[ij][i][j] = max(mx[ij][i][j], tab[ij][i][j]);
        j++;
      }
      i++, j = 1;
    }
    i = 1, j = 1, ij++;
  }
  printf("%d", mx[x][n][m]);
  return 0;
}
