#include <bits/stdc++.h>
using namespace std;
int n, i, j, m, k, p, len;
char a[1005], b[1005];
int lcs[1005][1005];
int dp[1005][1005][11];
int main() {
  cin >> n >> m >> k;
  cin >> (a + 1) >> (b + 1);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (a[i] == b[j]) lcs[i][j] = 1 + lcs[i - 1][j - 1];
  for (p = 1; p <= k; p++)
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) {
        len = lcs[i][j];
        dp[i][j][p] = max(dp[i - 1][j][p], dp[i][j - 1][p]);
        dp[i][j][p] = max(dp[i][j][p], dp[i - len][j - len][p - 1] + len);
      }
  printf("%d", dp[n][m][k]);
  return 0;
}
