#include <bits/stdc++.h>
using namespace std;
const int N = 1002;
int n, m, k;
int best[N][N];
int dp[N][N][10];
string a, b;
int solve(int i, int j) {
  if (i == n || j == m) return best[i][j] = 0;
  int &ret = best[i][j];
  if (ret != -1) return ret;
  if (a[i] == b[j])
    ret = solve(i + 1, j + 1) + 1;
  else
    ret = 0;
  return ret;
}
int calc(int i, int j, int rem) {
  if (i >= n || j >= m) {
    if (rem) return -(1 << 25);
    return 0;
  }
  if (!rem) return 0;
  int &ret = dp[i][j][rem];
  if (ret != -1) return ret;
  int len = solve(i, j);
  if (!len)
    ret = max(calc(i + 1, j, rem), calc(i, j + 1, rem));
  else {
    int r = min(len, rem);
    ret = max(calc(i + 1, j, rem), calc(i, j + 1, rem));
    for (int l = 0; l < r; ++l) {
      ret = max(ret, calc(i + len - l, j + len - l, rem - 1) + len - l);
    }
  }
  return ret;
}
int main() {
  cin >> n >> m >> k >> a >> b;
  memset(best, -1, sizeof(best));
  memset(dp, -1, sizeof(dp));
  cout << calc(0, 0, k) << endl;
  return 0;
}
