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