#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 1e3 + 10, INF = 0x3f3f3f3f, MOD = 1e9 + 7;
int n, m, K;
char s[N], t[N];
int f[N][N][15];
int lcp[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  clock_t _ = clock();
  while (scanf("%d%d%d", &n, &m, &K) == 3) {
    scanf("%s%s", s + 1, t + 1);
    memset(lcp, 0, sizeof lcp);
    for (int i = n; i; --i)
      for (int j = m; j; --j)
        if (s[i] == t[j]) lcp[i][j] = lcp[i + 1][j + 1] + 1;
    f[0][0][0] = 0;
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= m; ++j) {
        for (int k = 0; k <= K; ++k) {
          int c = lcp[i + 1][j + 1];
          f[i + c][j + c][k + 1] = max(f[i + c][j + c][k + 1], f[i][j][k] + c);
          f[i + 1][j][k] = max(f[i + 1][j][k], f[i][j][k]);
          f[i][j + 1][k] = max(f[i][j + 1][k], f[i][j][k]);
        }
      }
    }
    auto see = [&](int i, int j, int k) {
      printf("f[%d][%d][%d] = %d\n", i, j, k, f[i][j][k]);
    };
    int ans = 0;
    for (int i = 1; i <= K; ++i) {
      if (f[n][m][i] >= K) ans = max(ans, f[n][m][i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
