#include <bits/stdc++.h>
using namespace std;
int N, M, K;
char a[1001], b[1001];
int mem[1001][1001][11][2];
int main() {
  scanf("%d %d %d", &N, &M, &K);
  scanf("%s %s", a, b);
  memset(mem, 0, sizeof(mem));
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= M; j++) {
      for (int k = 1; k <= K; k++) {
        if (a[i - 1] == b[j - 1]) {
          mem[i][j][k][1] =
              max(mem[i - 1][j - 1][k][1] + 1, mem[i - 1][j - 1][k - 1][0] + 1);
          mem[i][j][k][0] =
              max(mem[i][j][k][1],
                  max(max(mem[i - 1][j][k][1], mem[i - 1][j][k][0]),
                      max(mem[i][j - 1][k][1], mem[i][j - 1][k][0])));
        } else {
          mem[i][j][k][1] = 0;
          mem[i][j][k][0] = max(max(mem[i - 1][j][k][1], mem[i - 1][j][k][0]),
                                max(mem[i][j - 1][k][1], mem[i][j - 1][k][0]));
        }
        if (k == K) {
          ans = max(ans, max(mem[i][j][k][0], mem[i][j][k][1]));
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
