#include <bits/stdc++.h>
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long long MXLL = 4611686018427387903;
const int Sz = 1001;
using namespace std;
inline void Read_rap() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
}
char a[Sz], b[Sz];
int n, m, k;
int dp[Sz][Sz][11][2];
int ans = 0;
int main() {
  Read_rap();
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) cin >> b[i];
  for (int s = 1; s <= k; s++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (a[i] == b[j]) {
          dp[i][j][s][1] = max(
              dp[i][j][s][1],
              max(dp[i - 1][j - 1][s - 1][0], dp[i - 1][j - 1][s - 1][1]) + 1);
          dp[i][j][s][1] =
              max(dp[i][j][s][1],
                  max(dp[i - 1][j - 1][s][0], dp[i - 1][j - 1][s][1]) + 1);
        }
      }
    }
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        for (int e = 0; e <= 1; e++) {
          dp[i][j][s][e] =
              max(dp[i][j][s][e], max(dp[i - 1][j][s][e], dp[i][j - 1][s][e]));
          ans = max(ans, dp[i][j][s][e]);
        }
  }
  cout << ans;
  return 0;
}
