#include <bits/stdc++.h>
using namespace std;
int dX[] = {0, 0, 1, -1};
int dY[] = {1, -1, 0, 0};
const int N = 1005;
const long long MOD = 998244353;
const double EBS = 1e-7;
int dp[N][N][15][2], n, m, k;
string a, b;
int solve(int i, int j, int rem, bool last) {
  if (i == n || j == m || rem <= 0) return 0;
  int& ret = dp[i][j][rem][last];
  if (~ret) return ret;
  if (a[i] == b[j]) ret = solve(i + 1, j + 1, rem, 1) + 1;
  ret = max(ret, solve(i, j + 1, rem - last, 0));
  ret = max(ret, solve(i + 1, j, rem - last, 0));
  return ret;
}
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  cin >> a >> b;
  memset(dp, -1, sizeof(dp));
  printf("%d\n", solve(0, 0, k, 0));
  return 0;
}
