#include <bits/stdc++.h>
using namespace std;
int n, m, k, i, j, l;
int dp[1005][1005][12][2];
string s, t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  cin >> s >> t;
  s += "#";
  t += "$";
  for (l = 1; l <= k; l++) {
    for (i = 0; i < s.size(); i++) {
      for (j = 0; j < t.size(); j++) dp[i][j][l][0] = dp[i][j][l][1] = -1;
    }
  }
  for (l = 0; l <= k; l++) {
    for (i = 0; i < s.size(); i++) {
      for (j = 0; j < t.size(); j++) {
        if (dp[i][j][l][0] == -1) continue;
        if (s[i] == t[j]) {
          dp[i + 1][j + 1][l][1] = max(dp[i + 1][j + 1][l][1],
                                       max(dp[i][j][l][0], dp[i][j][l][1]) + 1);
          dp[i + 1][j + 1][l + 1][0] =
              max(dp[i + 1][j + 1][l + 1][1],
                  max(dp[i][j][l][0], dp[i][j][l][1]) + 1);
        }
        dp[i + 1][j][l + 1][0] = max(dp[i + 1][j][l + 1][0], dp[i][j][l][1]);
        dp[i][j + 1][l + 1][0] = max(dp[i][j + 1][l + 1][0], dp[i][j][l][1]);
        dp[i + 1][j][l][0] = max(dp[i + 1][j][l][0], dp[i][j][l][0]);
        dp[i][j + 1][l][0] = max(dp[i][j + 1][l][0], dp[i][j][l][0]);
      }
    }
  }
  cout << dp[n][m][k][0];
  return 0;
}
