#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k0;
  cin >> n >> m >> k0;
  string s, t;
  cin >> s >> t;
  int dp[n + 1][m + 1][k0 + 1][2];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      dp[i][j][0][0] = dp[i][j][0][1] = 0;
    }
  }
  for (int j = 0; j <= m; j++) {
    for (int k = 1; k <= k0; k++) {
      dp[n][j][k][0] = -100000;
      dp[n][j][k][1] = dp[n][j][k - 1][0];
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int k = 1; k <= k0; k++) {
      dp[i][m][k][0] = -100000;
      dp[i][m][k][1] = dp[i][m][k - 1][0];
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      for (int k = 1; k <= k0; k++) {
        if (s[i] == t[j]) {
          dp[i][j][k][0] = max(max(dp[i + 1][j][k][0], dp[i][j + 1][k][0]),
                               1 + dp[i + 1][j + 1][k][1]);
          dp[i][j][k][1] = max(
              max(1 + dp[i + 1][j + 1][k][1], 1 + dp[i + 1][j + 1][k - 1][1]),
              dp[i][j][k - 1][0]);
        } else {
          dp[i][j][k][0] = max(dp[i + 1][j][k][0], dp[i][j + 1][k][0]);
          dp[i][j][k][1] = dp[i][j][k - 1][0];
        }
      }
    }
  }
  cout << dp[0][0][k0][0] << endl;
  return 0;
}
