#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXLEN = 1000;
const int MAXWANT = 10;
int alen, blen, want;
char a[MAXLEN + 1], b[MAXLEN + 1];
int match[MAXLEN + 1][MAXLEN + 1];
int dp[MAXLEN + 1][MAXLEN + 1][MAXWANT + 1];
void run() {
  scanf("%d%d%d%s%s", &alen, &blen, &want, a, b);
  for (int i = alen; i >= 0; --i)
    for (int j = blen; j >= 0; --j) {
      match[i][j] = 0;
      if (i < alen && j < blen && a[i] == b[j])
        match[i][j] = 1 + match[i + 1][j + 1];
    }
  memset(dp, 0, sizeof(dp));
  int ret = 0;
  for (int k = (0); k <= (want); ++k)
    for (int i = (0); i <= (alen); ++i)
      for (int j = (0); j <= (blen); ++j) {
        int z = match[i][j], nval = dp[i][j][k] + z;
        if (dp[i][j][k] > ret) ret = dp[i][j][k];
        if (k < want && nval > dp[i + z][j + z][k + 1])
          dp[i + z][j + z][k + 1] = nval;
        if (i < alen && dp[i][j][k] > dp[i + 1][j][k])
          dp[i + 1][j][k] = dp[i][j][k];
        if (j < blen && dp[i][j][k] > dp[i][j + 1][k])
          dp[i][j + 1][k] = dp[i][j][k];
      }
  printf("%d\n", ret);
}
int main() {
  run();
  return 0;
}
