#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  char c;
  bool nega = 0;
  while ((!isdigit(c = getchar())) && (c != '-'))
    ;
  if (c == '-') {
    nega = 1;
    c = getchar();
  }
  x = c - 48;
  while (isdigit(c = getchar())) x = x * 10 + c - 48;
  if (nega) x = -x;
}
template <typename T>
inline void writep(T x) {
  if (x > 9) writep(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  writep(x);
}
template <typename T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
int F[1005][1005][15];
int LCS[1005][1005];
int n, m, k;
string s, t;
int main() {
  cin >> n >> m >> k;
  cin >> s >> t;
  s = '*' + s, t = '*' + t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i] == t[j]) {
        LCS[i][j] = LCS[i - 1][j - 1] + 1;
      }
    }
  }
  for (int p = 1; p <= k; p++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        int common = LCS[i][j];
        F[i][j][p] = max(F[i - 1][j][p], F[i][j - 1][p]);
        F[i][j][p] = max(F[i][j][p], F[i - common][j - common][p - 1] + common);
      }
    }
  }
  cout << F[n][m][k];
}
