#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 1000 * 1000;
const long long inf64 = 1ll * inf * inf;
bool solve() {
  int n, m, kk;
  cin >> n >> m >> kk;
  string s, t;
  cin >> s >> t;
  vector<vector<int> > lcp(n, vector<int>(m));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i] == t[j]) {
        lcp[i][j] = (i > 0 && j > 0 ? lcp[i - 1][j - 1] : 0) + 1;
      }
    }
  }
  vector<vector<vector<int> > > dp(
      n, vector<vector<int> >(m, vector<int>(kk + 1)));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 1; k <= kk; k++) {
        if (i > 0) dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k]);
        if (j > 0) dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
        int _lcp = lcp[i][j];
        if (_lcp > 0) {
          int tmp =
              (i - _lcp >= 0 && j - _lcp >= 0 ? dp[i - _lcp][j - _lcp][k - 1]
                                              : 0) +
              _lcp;
          dp[i][j][k] = max(dp[i][j][k], tmp);
        }
      }
    }
  }
  int res = 0;
  for (int k = 1; k <= kk; k++) res = max(res, dp[n - 1][m - 1][k]);
  cout << res << '\n';
  return true;
}
int main() {
  solve();
  return 0;
}
