#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
const int OO = 0x3f3f3f3f;
using namespace std;
string s, t;
long long n, m, k, dp[1001][1001][11][3];
long long solve(int i, int j, int cnt, bool last) {
  if (i == s.size() || j == t.size() || cnt == -1)
    return (cnt == -1 ? -1e18 : 0);
  if (~dp[i][j][cnt][last]) return dp[i][j][cnt][last];
  long long ans = max(solve(i + 1, j, cnt, 0), solve(i, j + 1, cnt, 0));
  if (s[i] == t[j])
    ans = max(ans, max(solve(i + 1, j + 1, cnt - 1, 1) + 1,
                       (last ? solve(i + 1, j + 1, cnt, 1) + 1 : 0)));
  return dp[i][j][cnt][last] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> k >> s >> t;
  cout << solve(0, 0, k, 0);
  return 0;
}
