#include <bits/stdc++.h>
using namespace std;
int n, m;
string s, t;
int dp[1002][1002][15][2];
int solve(int i, int j, int rem, bool ok) {
  if (rem < 0) return -1e4;
  int &ret = dp[i][j][rem][ok];
  if (i == n || j == m) {
    return ret = 0;
  }
  if (ret != -1) return ret;
  int x1 = -1, x2 = -1, x3 = -1;
  x1 = solve(i + 1, j, rem, 0);
  x2 = solve(i, j + 1, rem, 0);
  if (s[i] == t[j]) {
    x3 = 1 + solve(i + 1, j + 1, rem - !ok, 1);
  }
  return ret = max(x1, max(x2, x3));
}
int main() {
  memset(dp, -1, sizeof(dp));
  int k;
  cin >> n >> m >> k;
  cin >> s >> t;
  int ans = solve(0, 0, k, 0);
  cout << ans << endl;
  return 0;
}
