#include <bits/stdc++.h>
using namespace std;
char s[1005], t[1005];
int f[1005][1005][11][2];
int main() {
  int n, m, k, ans;
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", s + 1, t + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int l = 1; l <= k; l++) {
        if (s[i] == t[j]) {
          f[i][j][l][1] =
              max(f[i - 1][j - 1][l - 1][0], f[i - 1][j - 1][l][1]) + 1;
        }
        f[i][j][l][0] = max(f[i - 1][j - 1][l][0], f[i][j][l][0]);
        f[i][j][l][0] = max(f[i - 1][j][l][0], f[i][j][l][0]);
        f[i][j][l][0] = max(f[i][j - 1][l][0], f[i][j][l][0]);
        f[i][j][l][0] = max(f[i][j][l][1], f[i][j][l][0]);
      }
  ans = max(f[n][m][k][1], f[n][m][k][0]);
  printf("%d", ans);
  return 0;
}
