#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
const double pi = acos(-1.0);
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const int N = 1e3 + 5;
int n, m, k;
string s, t;
int dp[N][N][11][2];
int solve(int i, int j, int taken, int done) {
  if (i >= n || j >= m || taken >= k) {
    return 0;
  }
  if (dp[i][j][taken][done] != -1) {
    return dp[i][j][taken][done];
  }
  int a = -1, b = -1, c = -1;
  if (s[i] == t[j]) {
    a = 1 + solve(i + 1, j + 1, taken, 1);
  }
  b = solve(i + 1, j, taken + done, 0);
  c = solve(i, j + 1, taken + done, 0);
  return dp[i][j][taken][done] = max(a, max(b, c));
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> k >> s >> t;
  cout << solve(0, 0, 0, 0) << '\n';
  return 0;
}
