#include <bits/stdc++.h>
using namespace std;
const int maxn = 1003;
int dp[maxn][maxn][12];
string a, b;
int f(int i, int j, int k) {
  if (i == a.size() or j == b.size() or k == 0) return 0;
  if (dp[i][j][k] != -1) return dp[i][j][k];
  int len = 0, ori_i = i, ori_j = j;
  while (i < a.size() and j < b.size() and a[i] == b[j]) i++, j++, len++;
  int ans = len + f(i, j, k - 1);
  i = ori_i, j = ori_j;
  return dp[i][j][k] = max(ans, max(f(i + 1, j, k), f(i, j + 1, k)));
}
int main() {
  int n, m, k;
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> k >> a >> b;
  cout << f(0, 0, k);
  return 0;
}
