#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
const int maxm = 1e6 + 50;
const double eps = 1e-10;
const int max_index = 62;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
inline int read() {
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x;
}
char s[1005], t[1005];
int com[1005][1005];
int dp[1005][1005][15];
int main() {
  int n = read(), m = read(), K = read();
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i] == t[j]) com[i][j] = com[i - 1][j - 1] + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = 1; k <= K; k++) {
        dp[i][j][k] = max(dp[i - 1][j][k], dp[i][j][k]);
        dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j][k]);
        int d = com[i][j];
        dp[i][j][k] = max(dp[i][j][k], dp[i - d][j - d][k - 1] + d);
      }
    }
  }
  cout << dp[n][m][K] << "\n";
  return 0;
}
