#include <bits/stdc++.h>
using namespace std;
char a[1111];
char b[1111];
long long int dp[1111][1111][11];
long long int mark[1111][1111];
int main() {
  long long int i, j, k, l, w, ww, x, y, z, n, m;
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &l);
  scanf("%s", a);
  scanf("%s", b);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i - 1] == b[j - 1]) {
        mark[i][j] = mark[i - 1][j - 1] + 1;
      } else {
        mark[i][j] = 0;
      }
      dp[i][j][1] = mark[i][j];
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= l; k++) {
        dp[i][j][k] =
            max(dp[i - mark[i][j]][j - mark[i][j]][k - 1] + mark[i][j],
                dp[i - 1][j][k]);
        dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
        dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j - 1][k]);
      }
    }
  }
  long long int ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= l; k++) {
        ans = max(ans, dp[i][j][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
