#include <bits/stdc++.h>
using namespace std;
string s, t;
int n, m, k;
int dp[1001][1001][11][2];
int solve(int i, int j, int p, int status) {
  if (i == n || j == m) return 0;
  if (dp[i][j][p][status] != -1) return dp[i][j][p][status];
  int ans;
  ans = 0;
  if (s[i + 1] != t[j + 1]) {
    if (p <= k) ans = max(solve(i + 1, j, p, 0), solve(i, j + 1, p, 0));
  } else {
    if (status == 0) {
      if (p + 1 <= k) ans = 1 + solve(i + 1, j + 1, p + 1, 1);
      if (p <= k) ans = max(ans, solve(i + 1, j, p, 0));
      if (p <= k) ans = max(ans, solve(i, j + 1, p, 0));
    } else {
      if (p <= k)
        ans = max(1 + solve(i + 1, j + 1, p, 0), 1 + solve(i + 1, j + 1, p, 1));
    }
  }
  return dp[i][j][p][status] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  cin >> s;
  cin >> t;
  s = " " + s;
  t = " " + t;
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0, 0, 0) << "\n";
  return 0;
}
