#include <bits/stdc++.h>
using namespace std;
char a[1010], b[1010];
int n, m, k;
int dp[1010][1010][11][2];
int calc(int l, int r, int k, int mt) {
  if (k < 0) return -1000000;
  if (l == n || r == m) {
    return (k == 0) ? 0 : (k == 1) ? (!mt) * -1000000 : -1000000;
  }
  int &ret = dp[l][r][k][mt];
  if (ret != -1) return ret;
  ret = max(calc(l + 1, r, k, 0), calc(l, r + 1, k, 0));
  if (a[l] == b[r]) {
    ret = max(ret, 1 + calc(l + 1, r + 1, k - 1, 1));
    if (mt) {
      ret = max(ret, 1 + calc(l + 1, r + 1, k, 1));
    }
  }
  return ret;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  scanf("%s", a);
  scanf("%s", b);
  memset(dp, -1, sizeof dp);
  printf("%d\n", calc(0, 0, k, 0));
  return 0;
}
