#include <bits/stdc++.h>
using namespace std;
char A[1006], B[1006];
int dp[11][1006][1006][2];
int vist, vis[11][1006][1006][2];
int rec(int k, int a, int b, bool op) {
  if (k == 0) return 0;
  if (A[a] == 0 || B[b] == 0) {
    if (k > 1)
      return -1000000009;
    else
      return 0;
  }
  int &ret = dp[k][a][b][op];
  if (vis[k][a][b][op] == vist) return ret;
  vis[k][a][b][op] = vist;
  int w, x, y, z;
  w = x = y = z = -1000000009;
  if (op) w = rec(k - 1, a, b, 0);
  if (op == 0) x = rec(k, a + 1, b, 0), y = rec(k, a, b + 1, 0);
  if (A[a] == B[b]) z = rec(k, a + 1, b + 1, 1) + 1;
  ret = max(max(w, x), max(y, z));
  return ret;
}
int main() {
  int N, M, K;
  scanf("%d %d %d", &N, &M, &K);
  scanf("%s %s", A, B);
  ++vist;
  printf("%d\n", rec(K, 0, 0, 0));
  return 0;
}
