#include <bits/stdc++.h>
using namespace std;
char str1[1005];
char str2[1005];
int dp[1005][1005][11];
int pipei[1005][1005];
void Init(int n, int m) {
  memset(dp, 0, sizeof(dp));
  memset(pipei, 0, sizeof(pipei));
  int i, j;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (str1[i - 1] == str2[j - 1]) {
        pipei[i][j] = pipei[i - 1][j - 1] + 1;
      } else
        pipei[i][j] = 0;
    }
  }
}
int main(void) {
  int i, j;
  int n, m, k;
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    scanf("%s", str1);
    scanf("%s", str2);
    Init(n, m);
    int s;
    for (s = 1; s <= k; s++) {
      for (i = 1; i <= n; i++) {
        for (j = 1; j <= m; j++) {
          if (str1[i - 1] != str2[j - 1]) {
            dp[i][j][s] = max(dp[i - 1][j][s], dp[i][j - 1][s]);
          } else {
            dp[i][j][s] = max(dp[i - 1][j - 1][s], dp[i - 1][j][s]);
            dp[i][j][s] = max(dp[i][j][s], dp[i][j - 1][s]);
            dp[i][j][s] =
                max(dp[i][j][s],
                    dp[i - pipei[i][j]][j - pipei[i][j]][s - 1] + pipei[i][j]);
          }
        }
      }
    }
    printf("%d\n", dp[n][m][k]);
  }
  return 0;
}
