#include <bits/stdc++.h>
using namespace std;
template <class T>
void print_array(T a[], int size) {
  for (int i = 0; i < size; i++) cout << a[i] << " ";
  cout << endl;
}
template <class T>
void print_array_v(T &a) {
  int size = a.size();
  for (int i = 0; i < size; i++) cout << a[i] << " ";
  cout << endl;
}
unsigned long long s_table[1001][1001], t_table[1001][1001];
long long int dp[1005][1005][11];
long long int n, m;
void make_table(string &s, bool ist) {
  long long int i, j, val;
  for (i = 0; i < s.length(); i++) {
    val = 0;
    for (j = i; j < s.length(); j++) {
      val = val * 27 + s[j] - 'a';
      if (!ist)
        s_table[i][j] = val;
      else
        t_table[i][j] = val;
    }
  }
}
long long int cal(string &s, string &t, long long int i, long long int j,
                  long long int k) {
  if (k <= 0 || i >= n || j >= m) return 0;
  if (dp[i][j][k] != -1) return dp[i][j][k];
  long long int maxi = 0;
  maxi = max(maxi, cal(s, t, i + 1, j, k));
  maxi = max(maxi, cal(s, t, i, j + 1, k));
  if (s[i] != t[j]) return dp[i][j][k] = maxi;
  long long int low = i, high = min(n - 1, i + (m - 1 - j)), mid;
  while (low <= high) {
    mid = (low + high) / 2;
    if (s_table[i][mid] == t_table[j][j + mid - i])
      low = mid + 1;
    else
      high = mid - 1;
  }
  maxi =
      max(maxi, high - i + 1 + cal(s, t, high + 1, j + (high - i) + 1, k - 1));
  return dp[i][j][k] = maxi;
}
int main() {
  long long int k, val, i, j, tt;
  string s, t;
  scanf("%lld", &n);
  scanf("%lld", &m);
  scanf("%lld", &k);
  cin >> s;
  cin >> t;
  make_table(s, 0);
  make_table(t, 1);
  for (i = 0; i < 1001; i++)
    for (j = 0; j < 1001; j++)
      for (tt = 0; tt <= 10; tt++) dp[i][j][tt] = -1;
  val = cal(s, t, 0, 0, k);
  printf("%lld\n", val);
  return 0;
}
