#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmax(T1& x, T2 y) {
  if (x < y) x = y;
}
template <typename T1, typename T2>
inline void chkmin(T1& x, T2 y) {
  if (x > y) x = y;
}
const int MAXN = 1e3 + 1;
short kek[MAXN][MAXN], dp[11][MAXN][MAXN];
pair<short, short> pushed[MAXN][MAXN];
vector<short> to_er[MAXN];
void push(int cnt, int n, int m) {
  for (int i = 0; i <= n; ++i) {
    multiset<short> vals;
    int add = 0;
    for (int j = 0; j <= m && i + j <= n; ++j, ++add) {
      if (!vals.empty()) chkmax(dp[cnt][i + j][j], *vals.rbegin() + add);
      while (!to_er[j].empty()) {
        vals.erase(to_er[j].back());
        to_er[j].pop_back();
      }
      if (pushed[i + j][j].second) {
        to_er[j + pushed[i + j][j].second].push_back(pushed[i + j][j].first -
                                                     add);
        vals.insert(pushed[i + j][j].first - add);
      }
      pushed[i + j][j] = {0, 0};
    }
  }
  for (int j = 0; j <= m; ++j) {
    multiset<short> vals;
    int add = 0;
    for (int i = 0; i <= n && j + i <= m; ++i, ++add) {
      if (!vals.empty()) chkmax(dp[cnt][i][j + i], *vals.rbegin() + add);
      while (!to_er[i].empty()) {
        vals.erase(to_er[i].back());
        to_er[i].pop_back();
      }
      if (pushed[i][j + i].second) {
        to_er[i + pushed[i][j + i].second].push_back(pushed[i][j + i].first -
                                                     add);
        vals.insert(pushed[i][j + i].first - add);
      }
      pushed[i][j + i] = {0, 0};
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  string st1, st2;
  cin >> st1 >> st2;
  for (int i = n - 1; i >= 0; --i)
    for (int j = m - 1; j >= 0; --j)
      kek[i][j] = (st1[i] == st2[j] ? kek[i + 1][j + 1] + 1 : 0);
  for (int cnt = 0; cnt < k; ++cnt) {
    push(cnt, n, m);
    int tmp = 0;
    for (int l1 = 0; l1 < n; ++l1) {
      for (int l2 = 0; l2 < m; ++l2) {
        tmp = dp[cnt][l1][l2];
        chkmax(dp[cnt][l1 + 1][l2], tmp);
        chkmax(dp[cnt][l1][l2 + 1], tmp);
        pushed[l1][l2] = {tmp, kek[l1][l2]};
      }
    }
  }
  push(k, n, m);
  int ans = 0;
  for (int cnt = 0; cnt <= k; ++cnt)
    for (int l1 = 0; l1 <= n; ++l1)
      for (int l2 = 0; l2 <= m; ++l2) chkmax(ans, dp[k][l1][l2]);
  cout << ans;
  return 0;
}
