#include <bits/stdc++.h>
using namespace std;
int N, M, K;
string s, t;
int memo[1001][1001][11][2];
int dp(int i, int j, int k, bool flag) {
  if (memo[i][j][k][flag] != -1) return memo[i][j][k][flag];
  if (k == K && !flag) return 0;
  int ans = 0;
  if (i < N) ans = max(ans, dp(i + 1, j, k, false));
  if (j < M) ans = max(ans, dp(i, j + 1, k, false));
  if (i < N && j < M && s[i] == t[j])
    ans = max(ans, 1 + dp(i + 1, j + 1, k + 1 - flag, true));
  return memo[i][j][k][flag] = ans;
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  cin >> s >> t;
  for (int i = 0; i <= N; ++i)
    for (int j = 0; j <= M; ++j)
      for (int k = 0; k <= K; ++k) memo[i][j][k][0] = memo[i][j][k][1] = -1;
  printf("%d\n", dp(0, 0, 0, false));
}
