#include <bits/stdc++.h>
using namespace std;
vector<int> z_function(const char* s, int n) {
  vector<int> z(n);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) {
      l = i;
      r = i + z[i] - 1;
    }
  }
  return z;
}
int longestSeq[1005][1005];
char s[1005];
char t[1005];
int dp[1005][1005][15];
int main(int argc, char const* argv[]) {
  int n, m, k;
  scanf("%d %d", &n, &m);
  scanf("%d", &k);
  scanf("%s", s);
  scanf("%s", t);
  string st = string(s) + "#" + string(t);
  for (int i = 0; i < n; i += 1) {
    vector<int> zf = z_function(st.c_str() + i, st.size());
    for (int j = 0; j < m; ++j) {
      longestSeq[i][j] = zf[j + n + 1 - i];
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      for (int l = 1; l <= k; l += 1) {
        dp[i][j][l] = max(dp[i + 1][j][l], dp[i][j + 1][l]);
        if (longestSeq[i][j]) {
          int ls = longestSeq[i][j];
          dp[i][j][l] = max(dp[i][j][l], ls + dp[i + ls][j + ls][l - 1]);
        }
      }
    }
  }
  printf("%d\n", dp[0][0][k]);
  return 0;
}
