#include <bits/stdc++.h>
using namespace std;
int getta[1009][1009], dp[1009][1009][12], visit[1009][1009][12], ar[1009],
    pr[1009];
string aa, ss;
int check(int n, int m, int k) {
  if (n == 0) return 0;
  if (m == 0) return 0;
  if (k == 0) return 0;
  if (visit[n][m][k]) return dp[n][m][k];
  visit[n][m][k] = 1;
  int now, ans = 0;
  now = getta[n][m];
  if (now) {
    ans = max(ans, check(n - now, m - now, k - 1) + now);
  }
  ans = max(ans, check(n - 1, m, k));
  ans = max(ans, check(n, m - 1, k));
  return dp[n][m][k] = ans;
}
int main() {
  int i, j, k, l, m, ans, n;
  cin >> n >> m >> k;
  cin >> aa;
  cin >> ss;
  for (i = 1; i <= n; i++) ar[i] = aa[i - 1] - 'a' + 1;
  for (i = 1; i <= m; i++) pr[i] = ss[i - 1] - 'a' + 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (ar[i] == pr[j]) getta[i][j] = 1 + getta[i - 1][j - 1];
    }
  }
  cout << check(n, m, k) << endl;
}
