#include <bits/stdc++.h>
using namespace std;
int dx[5] = {0, 0, 0, 1, -1}, dy[5] = {0, 1, -1, 0, 0};
const int base = 1007;
const int maxn = 1002;
int n, m, K, res;
int f[maxn][maxn][12][2], g[maxn][maxn][12];
char s[maxn], t[maxn];
int max3(int a, int b, int c) { return max(a, max(b, c)); }
int main() {
  int i, j, k, u, v;
  scanf("%d%d%d\n", &n, &m, &K);
  scanf("%s\n", s + 1);
  scanf("%s\n", t + 1);
  for (k = 0; k <= K; k++) {
    for (i = 0; i <= n; i++) f[i][0][k][1] = -base;
    for (j = 0; j <= m; j++) f[0][j][k][1] = -base;
  }
  f[0][0][0][0] = 0;
  f[0][0][0][1] = -base;
  g[0][0][0] = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= K; k++) {
        f[i][j][k][0] =
            max3(g[i - 1][j - 1][k], g[i - 1][j][k], g[i][j - 1][k]);
        if (s[i] == t[j])
          f[i][j][k][1] =
              max(f[i - 1][j - 1][k][1], g[i - 1][j - 1][k - 1]) + 1;
        else
          f[i][j][k][1] = -base;
        g[i][j][k] = max(f[i][j][k][0], f[i][j][k][1]);
      }
      res = max(res, g[i][j][K]);
    }
  cout << res << "\n";
  return 0;
}
