#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string s, t;
int dp[1001][1001][11][2];
int solve(int idxs, int idxt, int rem, int cont) {
  if (idxs >= n || idxt >= m) return (rem == 0) ? 0 : INT_MIN;
  if (rem == 0) return 0;
  if (dp[idxs][idxt][rem][cont] != -1) return dp[idxs][idxt][rem][cont];
  int ret = INT_MIN;
  if (cont == 1) {
    ret = max(ret, solve(idxs + 1, idxt, rem - 1, 0));
    ret = max(ret, solve(idxs, idxt, rem - 1, 0));
    if (s[idxs] == t[idxt]) {
      ret = max(ret, 1 + solve(idxs + 1, idxt + 1, rem, 1));
      ret = max(ret, 1 + solve(idxs + 1, idxt + 1, rem - 1, 0));
    }
  } else {
    ret = max(ret, solve(idxs + 1, idxt, rem, 0));
    ret = max(ret, solve(idxs, idxt + 1, rem, 0));
    if (s[idxs] == t[idxt]) {
      ret = max(ret, 1 + solve(idxs + 1, idxt + 1, rem, 1));
      ret = max(ret, 1 + solve(idxs + 1, idxt + 1, rem - 1, 0));
    }
  }
  return dp[idxs][idxt][rem][cont] = ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> m >> k;
  cin >> s;
  cin >> t;
  cout << solve(0, 0, k, 0);
  return 0;
}
