#include <bits/stdc++.h>
using namespace std;
const int MAX_NM = 1005;
const int MAX_K = 12;
int N, M;
string s, t;
int memo[MAX_NM][MAX_NM][MAX_K][2];
int dp(int i, int j, int K, bool in) {
  if (i >= N || j >= M) return 0;
  if (K == 0) return 0;
  if (memo[i][j][K][in] == -1) {
    int best = 0;
    if (in) {
      best = max(best, dp(i + 1, j, K - 1, 0));
      best = max(best, dp(i, j + 1, K - 1, 0));
    } else {
      best = max(best, dp(i + 1, j, K, 0));
      best = max(best, dp(i, j + 1, K, 0));
    }
    if (s[i] == t[j]) {
      best = max(best, 1 + dp(i + 1, j + 1, K, 1));
    }
    memo[i][j][K][in] = best;
  }
  return memo[i][j][K][in];
}
signed main() {
  int K;
  cin >> N >> M >> K;
  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;
      }
    }
  }
  cin >> s >> t;
  cout << dp(0, 0, K, 0) << endl;
}
