#include <bits/stdc++.h>
using namespace std;
string s, t;
int dp[1001][1001][11];
int cal[1001][1001];
int main() {
  s = t = "";
  int n, m, k;
  cin >> n >> m >> k;
  cin >> s >> t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (t[j - 1] == s[i - 1])
        cal[i][j] = 1 + cal[i - 1][j - 1];
      else
        cal[i][j] = 0;
    }
  }
  int len, ans = 0;
  for (int K = 1; K <= k; ++K) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        len = cal[i][j];
        dp[i][j][K] = max(max(dp[i - 1][j][K], dp[i][j - 1][K]),
                          dp[i - len][j - len][K - 1] + len);
        ans = max(ans, dp[i][j][K]);
      }
    }
  }
  cout << ans;
  return 0;
}
