#include <bits/stdc++.h>
using namespace std;
int dp[1001][1001][11];
int lcs[1001][1001];
int main(int argc, const char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k, i, j;
  string str1, str2;
  cin >> n >> m >> k;
  cin >> str1 >> str2;
  for (i = 0; i <= n; i++)
    for (j = 0; j <= m; j++) {
      if (i == 0 || j == 0)
        lcs[i][j] = 0;
      else {
        if (str1[i - 1] == str2[j - 1])
          lcs[i][j] = lcs[i - 1][j - 1] + 1;
        else
          lcs[i][j] = 0;
      }
    }
  for (i = 0; i <= n; i++)
    for (j = 0; j <= m; j++)
      for (int l = 0; l <= k; l++) dp[i][j][l] = 0;
  for (int l = 1; l <= k; l++) {
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        int len = lcs[i][j];
        if (str1[i - 1] == str2[j - 1]) {
          dp[i][j][l] = dp[i - len][j - len][l - 1] + len;
        }
        dp[i][j][l] = max(dp[i][j][l], max(dp[i - 1][j][l], dp[i][j - 1][l]));
      }
    }
  }
  cout << dp[n][m][k];
  return 0;
}
