#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 1010;
char a[N], b[N];
int n, m, k, sol, D[12][N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  cin >> (a + 1) >> (b + 1);
  for (int ku = 1; ku <= k; ++ku) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        if (a[i] == b[j]) {
          D[ku][i][j] =
              max(D[ku][i - 1][j - 1] + 1, D[ku - 1][i - 1][j - 1] + 1);
        }
      }
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        D[ku][i][j] = max(D[ku][i][j], max(D[ku][i - 1][j], D[ku][i][j - 1]));
        if (D[ku][i][j] > sol) {
          sol = D[ku][i][j];
        }
      }
    }
  }
  cout << sol;
  return 0;
}
