#include <bits/stdc++.h>
using namespace std;
int N, M, K;
string s, t;
int table[1001][1001][11];
int consecutive[1001][1001];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  cin >> N >> M >> K;
  cin >> s >> t;
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      if (t[j - 1] == s[i - 1])
        consecutive[i][j] = 1 + consecutive[i - 1][j - 1];
      else
        consecutive[i][j] = 0;
    }
  }
  int len, ans = 0;
  for (int k = 1; k <= K; ++k) {
    for (int i = 1; i <= N; ++i) {
      for (int j = 1; j <= M; ++j) {
        len = consecutive[i][j];
        table[i][j][k] = max(max(table[i - 1][j][k], table[i][j - 1][k]),
                             table[i - len][j - len][k - 1] + len);
        ans = max(ans, table[i][j][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
