#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int inf = 2e9 + 5;
double PI = 3.14159265358979323846;
const int N = 1005;
int n, m, k;
int dp[N][N][11][2];
string s, t;
int go(int i, int j, int cnt, int prev) {
  if (cnt > k) return -inf;
  if (i == n or j == m) return 0;
  if (dp[i][j][cnt][prev] != -1) {
    return dp[i][j][cnt][prev];
  }
  int ans = 0;
  ans = max(ans, go(i + 1, j, cnt, 0));
  ans = max(ans, go(i, j + 1, cnt, 0));
  if (s[i] == t[j]) {
    if (prev) {
      ans = max(ans, 1 + go(i + 1, j + 1, cnt, 1));
    } else {
      ans = max(ans, 1 + go(i + 1, j + 1, cnt + 1, 1));
    }
  }
  return dp[i][j][cnt][prev] = ans;
}
void solve() {
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof(dp));
  int ans = go(0, 0, 0, 0);
  cout << ans << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
