#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3;
char A[maxn + 1], B[maxn + 1];
int n, m, k, F[maxn + 1][maxn + 1][11][2], res;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int j = 1; j <= m; j++) cin >> B[j];
  for (int d = 0; d <= k; d++)
    for (int i = 0; i <= n; i++)
      for (int j = 0; j <= m; j++)
        for (int ok = 0; ok <= 1; ok++) {
          if (i < n) F[i + 1][j][d][0] = max(F[i + 1][j][d][0], F[i][j][d][ok]);
          if (j < m) F[i][j + 1][d][0] = max(F[i][j + 1][d][0], F[i][j][d][ok]);
          if (i < n && j < m && A[i + 1] == B[j + 1]) {
            if (d < k)
              F[i + 1][j + 1][d + 1][1] =
                  max(F[i + 1][j + 1][d + 1][1], F[i][j][d][ok] + 1);
            if (ok && d > 0)
              F[i + 1][j + 1][d][1] =
                  max(F[i + 1][j + 1][d][1], F[i][j][d][ok] + 1);
          }
        }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int ok = 0; ok <= 1; ok++) res = max(res, F[i][j][k][ok]);
  cout << res;
  return 0;
}
