#include <bits/stdc++.h>
using namespace std;
char a[1005], b[1005];
int n, m, k;
int dp[1005][1005];
int dp2[1005][1005][15];
int recur(int i, int j, int k) {
  if (i >= n || j >= m || k <= 0) return 0;
  int &ans = dp2[i][j][k];
  if (ans != -1) return ans;
  ans = max(recur(i + 1, j, k), recur(i, j + 1, k));
  ans = max(ans, dp[i][j] + recur(i + dp[i][j], j + dp[i][j], k - 1));
  return ans;
}
int main() {
  cin >> n >> m >> k;
  scanf(" %s", &a);
  scanf(" %s", &b);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (a[i] != b[j])
        dp[i][j] = 0;
      else
        dp[i][j] = 1 + dp[i + 1][j + 1];
    }
  }
  memset(dp2, -1, sizeof(dp2));
  int x = recur(0, 0, k);
  cout << x;
  return 0;
}
