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