#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m, k, sol = 0;
  cin >> n >> m >> k;
  string a, b;
  cin >> a >> b;
  vector<vector<vector<int> > > dp(
      n, vector<vector<int> >(m, vector<int>(k + 1, -1)));
  vector<vector<int> > longest(n, vector<int>(m, 0));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      dp[i][j][0] = 0;
      if (!i || !j) {
        longest[i][j] = (a[i] == b[j]);
      } else {
        if (a[i] == b[j]) {
          longest[i][j] = longest[i - 1][j - 1] + 1;
        } else {
          longest[i][j] = 0;
        }
      }
      int i1 = i - longest[i][j], j1 = j - longest[i][j];
      if (i1 < 0 || j1 < 0) {
        dp[i][j][1] = longest[i][j];
      } else {
        if (!i && !j)
          ;
        else {
          for (int p = 1; p <= k; ++p) {
            if (!i) {
              dp[i][j][p] = max(dp[i][j - 1][p], dp[i][j][p]);
            } else if (!j) {
              dp[i][j][p] = max(dp[i - 1][j][p], dp[i][j][p]);
            } else {
              dp[i][j][p] = max(max(dp[i - 1][j - 1][p],
                                    max(dp[i][j - 1][p], dp[i - 1][j][p])),
                                dp[i][j][p]);
            }
          }
        }
        if (longest[i][j]) {
          for (int p = 1; p <= k; ++p) {
            dp[i][j][p] = max(dp[i1][j1][p - 1] + longest[i][j], dp[i][j][p]);
          }
        }
      }
      for (int p = 1; p <= k; ++p) {
        sol = max(sol, dp[i][j][p]);
      }
    }
  }
  cout << sol;
  return 0;
}
