#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
long long n, m, k;
long long dp[1002][1002][12], maxi[1002][1002][12];
char t[1002], s[1002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  cin >> (s + 1);
  cin >> (t + 1);
  if (strcmp(s + 1, t + 1) == 0) {
    cout << n;
    return 0;
  }
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j) {
      for (int p = 0; p <= k; ++p) {
        maxi[i][j][p] = dp[i][j][p];
        if (i > 0) maxi[i][j][p] = max(maxi[i][j][p], maxi[i - 1][j][p]);
        if (j > 0) maxi[i][j][p] = max(maxi[i][j][p], maxi[i][j - 1][p]);
      }
      if (i == n && j == m) break;
      for (int p = 0; p < k; ++p) {
        if (maxi[i][j][p] < p) continue;
        int aa = i + 1;
        int bb = j + 1;
        while (s[aa] == t[bb] && (aa <= n && bb <= m))
          dp[aa][bb][p + 1] = max(dp[aa][bb][p + 1], maxi[i][j][p] + (aa - i)),
                         ++aa, ++bb;
      }
    }
  cout << maxi[n][m][k] << '\n';
  return 0;
}
