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