#include <bits/stdc++.h>
using namespace std;
const int N = 1001, M = 1001, K = 11;
int mem[N][M][K][2];
int m, n, k;
string s, t;
int f(int i, int j, int c, int b) {
  if (i == m || j == n || c > k) {
    return 0;
  }
  int& res = mem[i][j][c][b];
  if (res != -1) {
    return res;
  }
  res = max(f(i, j + 1, c, 0), f(i + 1, j, c, 0));
  if (s[i] == t[j]) {
    if (b) {
      res = max(res, 1 + f(i + 1, j + 1, c, 1));
    } else if (c < k) {
      res = max(res, 1 + f(i + 1, j + 1, c + 1, 1));
    }
  }
  return res;
}
int solve() {
  fill_n(&mem[0][0][0][0], N * M * K * 2, -1);
  return f(0, 0, 0, 0);
}
int main() {
  std::iostream::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  while (true) {
    cin >> m >> n >> k;
    cin >> s >> t;
    if (not cin) {
      break;
    }
    cout << solve() << endl;
  }
  return 0;
}
