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