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