#include <bits/stdc++.h>
using namespace std;
int len[1010][1010];
int dp[1010][1010][12];
char s[1010], t[1010];
int main() {
  int n, m, K, i, j, k;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &K);
  cin >> (s + 1);
  cin >> (t + 1);
  for (i = 0; i <= n; ++i) {
    for (j = 0; j <= m; ++j) {
      len[i][j] = 0;
      for (k = 1; k <= K; ++k) dp[i][j][k] = -100000;
      dp[i][j][0] = 0;
    }
  }
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      if (s[i] == t[j]) len[i][j] = 1 + len[i - 1][j - 1];
      for (k = 1; k <= K; ++k) {
        dp[i][j][k] = max(dp[i][j - 1][k], dp[i - 1][j][k]);
        if (!len[i][j]) continue;
        dp[i][j][k] = max(dp[i][j][k],
                          dp[i - len[i][j]][j - len[i][j]][k - 1] + len[i][j]);
      }
    }
  }
  int ans = 0;
  for (i = 1; i <= K; ++i) ans = max(ans, dp[n][m][i]);
  printf("%d\n", ans);
}
