#include <bits/stdc++.h>
const int N_MAX = 1000 + 1;
const int M_MAX = 1000 + 1;
const int K_MAX = 10 + 1;
char A[N_MAX], B[M_MAX];
int f[N_MAX][M_MAX][K_MAX], g[N_MAX][M_MAX][K_MAX];
int main(int argc, char *argv[]) {
  int N, M, K;
  scanf("%d %d %d %s %s", &N, &M, &K, A + 1, B + 1);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      if (A[i] == B[j]) {
        for (int k = 1; k <= K; k++) {
          f[i][j][k] = std::max(f[i - 1][j - 1][k], g[i - 1][j - 1][k - 1]) + 1;
          g[i][j][k] =
              std::max(f[i][j][k], std::max(g[i - 1][j][k], g[i][j - 1][k]));
        }
      } else {
        for (int k = 1; k <= K; k++) {
          f[i][j][k] = 0;
          g[i][j][k] = std::max(g[i - 1][j][k], g[i][j - 1][k]);
        }
      }
    }
  }
  printf("%d\n", g[N][M][K]);
  return 0;
}
