#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f;
const double eps = 1e-6;
const double PI = acos(-1);
const double R = 0.57721566490153286060651209;
inline long long read() {
  long long res = 0;
  bool zf = 0;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  if (c == '-')
    zf = 1;
  else
    res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    res = (res << 3) + (res << 1) + c - '0';
  if (zf) return -res;
  return res;
}
const int N = 1000 + 10;
int dp[N][N][11][2];
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  string s, t;
  cin >> s >> t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int p = 0; p <= k; p++) {
        if (s[i - 1] == t[j - 1] && p) {
          dp[i][j][p][1] = max(dp[i][j][p][1], dp[i - 1][j - 1][p][1] + 1);
          dp[i][j][p][1] = max(dp[i][j][p][1], dp[i - 1][j - 1][p - 1][0] + 1);
        }
        dp[i][j][p][0] = max(dp[i - 1][j - 1][p][1], dp[i - 1][j - 1][p][0]);
        dp[i][j][p][0] =
            max(dp[i][j][p][0], max(dp[i - 1][j][p][0], dp[i - 1][j][p][1]));
        dp[i][j][p][0] =
            max(dp[i][j][p][0], max(dp[i][j - 1][p][0], dp[i][j - 1][p][1]));
      }
    }
  }
  cout << max(dp[n][m][k][1], dp[n][m][k][0]) << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
