#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int INF = 0x3f3f3f3f;
int match[N][N];
int n, m;
char s[N], t[N];
int pd[N][N][11];
int calcmatch(int ps, int pt) {
  if (ps >= n or pt >= m) return 0;
  if (match[ps][pt] != -1) return match[ps][pt];
  if (s[ps] != t[pt])
    match[ps][pt] = 0;
  else
    match[ps][pt] = 1 + calcmatch(ps + 1, pt + 1);
  return match[ps][pt];
}
int solve(int ps, int pt, int k) {
  if (k == 0) return 0;
  if (ps >= n or pt >= m) return -INF;
  if (pd[ps][pt][k] != -1) return pd[ps][pt][k];
  pd[ps][pt][k] = max(solve(ps + 1, pt, k), solve(ps, pt + 1, k));
  int sz = calcmatch(ps, pt);
  for (int i = 1; i <= min(k, sz); i++)
    pd[ps][pt][k] = max(pd[ps][pt][k], sz + solve(ps + sz, pt + sz, k - i));
  return pd[ps][pt][k];
}
int main() {
  int k;
  scanf("%d %d %d", &n, &m, &k);
  scanf("%s %s", s, t);
  memset(pd, -1, sizeof(pd));
  memset(match, -1, sizeof(match));
  printf("%d\n", solve(0, 0, k));
  return 0;
}
