#include <bits/stdc++.h>
using namespace std;
const int N = 1003;
int n, m, k, dp[N][N][12][2];
char a[N], b[N];
int calc(int i, int j, int rem, bool match) {
  if (!rem) return 0;
  if (i >= n || j >= m) return -1e6;
  int &ret = dp[i][j][rem][match];
  if (ret != -1) return ret;
  if (!match) ret = max(calc(i + 1, j, rem, 0), calc(i, j + 1, rem, 0));
  if (a[i] == b[j]) {
    ret = max(ret, 1 + calc(i + 1, j + 1, rem, 1));
    ret = max(ret, 1 + calc(i + 1, j + 1, rem - 1, 0));
  }
  return ret;
}
int main(int argc, char **argv) {
  scanf("%d%d%d%s%s", &n, &m, &k, a, b);
  memset(dp, -1, sizeof dp);
  return !printf("%d\n", calc(0, 0, k, 0));
}
