#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;
}
long long int dp[1005][1005][11][2];
long long int n, m;
long long int cal(string &s, string &t, long long int i, long long int j,
                  long long int k, bool was_last) {
  if (k <= 0 || i >= n || j >= m) return 0;
  if (dp[i][j][k][was_last] != -1) return dp[i][j][k][was_last];
  long long int maxi = 0;
  if (!was_last) {
    maxi = max(maxi, cal(s, t, i + 1, j, k, was_last));
    maxi = max(maxi, cal(s, t, i, j + 1, k, was_last));
    if (s[i] == t[j]) maxi = max(maxi, 1 + cal(s, t, i + 1, j + 1, k, 1));
    return dp[i][j][k][was_last] = maxi;
  }
  if (s[i] != t[j]) {
    maxi = max(maxi, cal(s, t, i + 1, j, k - 1, 0));
    maxi = max(maxi, cal(s, t, i, j + 1, k - 1, 0));
  } else
    maxi = max(maxi, 1 + cal(s, t, i + 1, j + 1, k, 1));
  return dp[i][j][k][was_last] = 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;
  for (i = 0; i < 1001; i++)
    for (j = 0; j < 1001; j++)
      for (tt = 0; tt <= 10; tt++) dp[i][j][tt][0] = dp[i][j][tt][1] = -1;
  val = cal(s, t, 0, 0, k, 0);
  printf("%lld\n", val);
  return 0;
}
