#include <bits/stdc++.h>
using namespace std;
pair<int, int> dp[1005][1005][15];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  string a, b;
  cin >> a >> b;
  for (int i = 1; i <= k; ++i) {
    for (int j = 0; j <= max(n, m); ++j) {
      dp[0][j][i].first = dp[0][j][i].second = -1;
      dp[j][0][i].first = dp[j][0][i].second = -1;
    }
    for (int j = 1; j <= n; ++j) {
      for (int l = 1; l <= m; ++l) {
        if (a[j - 1] != b[l - 1]) {
          dp[j][l][i].first = -1;
        } else {
          dp[j][l][i].first =
              max(dp[j - 1][l - 1][i].first, dp[j - 1][l - 1][i - 1].second);
          if (dp[j][l][i].first != -1) {
            ++dp[j][l][i].first;
          }
        }
        dp[j][l][i].second =
            max(dp[j][l][i].first,
                max(dp[j - 1][l][i].second, dp[j][l - 1][i].second));
      }
    }
  }
  cout << dp[n][m][k].second << "\n";
  return 0;
}
