#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
char a[N], b[N];
int lcp[N][N];
int f[N][N][12];
int main() {
  int l1, l2, n;
  scanf("%d%d%d", &l1, &l2, &n);
  scanf("%s%s", a + 1, b + 1);
  for (int i = (1); i <= (l1); i++) {
    for (int j = (1); j <= (l2); j++) {
      if (a[i] == b[j])
        lcp[i][j] = lcp[i - 1][j - 1] + 1;
      else
        lcp[i][j] = 0;
    }
  }
  int ans = n;
  for (int i = (1); i <= (l1); i++) {
    for (int j = (1); j <= (l2); j++) {
      for (int k = (1); k <= (n); k++) {
        int A = lcp[i][j];
        f[i][j][k] = max(f[i][j][k], f[i - A][j - A][k - 1] + A);
        if (f[i][j][k] > f[i + 1][j][k]) f[i + 1][j][k] = f[i][j][k];
        if (f[i][j][k] > f[i][j + 1][k]) f[i][j + 1][k] = f[i][j][k];
        ans = max(ans, f[i][j][k]);
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
