#include <bits/stdc++.h>
using namespace std;
int lcp[1010][1010];
int dp[1010][1010][12];
int K;
int n, m;
string a, b;
int solve(int i, int j, int k) {
  if (i >= n || j >= m) return 0;
  if (k == K) return 0;
  if (dp[i][j][k] != -1) return dp[i][j][k];
  int ret = 0;
  ret = solve(i + 1, j, k);
  ret = max(ret, solve(i, j + 1, k));
  if (lcp[i][j] != 0) {
    ret = max(ret, lcp[i][j] + solve(i + lcp[i][j], j + lcp[i][j], k + 1));
  }
  dp[i][j][k] = ret;
  return ret;
}
void lc() {
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (a[i] == b[j]) lcp[i][j] = 1 + lcp[i + 1][j + 1];
    }
  }
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> K;
  cin >> a >> b;
  lc();
  int ret = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      ret = max(ret, solve(i, j, 0));
    }
  }
  cout << ret << endl;
}
