#include <bits/stdc++.h>
using namespace std;
int con[1010][1010];
int dp[1010][1010][11];
int main() {
  int n, m, K, ans = 0;
  string s, t;
  cin >> n >> m >> K;
  cin >> s >> t;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i - 1] == t[j - 1])
        con[i][j] = 1 + con[i - 1][j - 1];
      else
        con[i][j] = 0;
  ans = 0;
  for (int k = 1; k <= K; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        int len = con[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 << endl;
  return 0;
}
