#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  vector<char> s1(n), s2(m);
  for (int i = 0; i < n; i++) {
    do {
      s1[i] = getchar();
    } while (s1[i] == '\n');
  }
  for (int i = 0; i < m; i++) {
    do {
      s2[i] = getchar();
    } while (s2[i] == '\n');
  }
  vector<vector<vector<pair<int, int>>>> dp(
      n, vector<vector<pair<int, int>>>(m, vector<pair<int, int>>(k)));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int l = 0; l < k; l++) {
        if (s1[i] == s2[j]) {
          if (i > 0 && j > 0) {
            dp[i][j][l].first = max(dp[i - 1][j - 1][l].first + 1,
                                    l > 0 ? max(dp[i - 1][j - 1][l - 1].second,
                                                dp[i - 1][j - 1][l - 1].first) +
                                                1
                                          : 0);
          } else {
            dp[i][j][l].first = 1;
          }
        }
        dp[i][j][l].second =
            max(i > 0 ? max(dp[i - 1][j][l].second, dp[i - 1][j][l].first) : 0,
                j > 0 ? max(dp[i][j - 1][l].first, dp[i][j - 1][l].second) : 0);
      }
    }
  }
  int result = 0;
  result = max(result, dp[n - 1][m - 1][k - 1].first);
  result = max(result, dp[n - 1][m - 1][k - 1].second);
  printf("%d\n", result);
  return 0;
}
