#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(vector<T> v) {
  for (long long int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
const long long int INF = 1e9;
long long int dp[1005][1005][15][2];
string s1, s2;
long long int help(long long int i, long long int j, long long int k,
                   long long int flag) {
  if (k < 0) return -INF;
  if (i == s1.size() && j == s2.size()) {
    return 0;
  }
  if (dp[i][j][k][flag] != -1) return dp[i][j][k][flag];
  long long int ret = -INF;
  if (i < s1.size()) ret = max(ret, help(i + 1, j, k, 0));
  if (j < s2.size()) ret = max(ret, help(i, j + 1, k, 0));
  if (i < s1.size() && j < s2.size() && s1[i] == s2[j]) {
    if (flag) ret = max(ret, 1 + help(i + 1, j + 1, k, 1));
    ret = max(ret, 1 + help(i + 1, j + 1, k - 1, 1));
  }
  return dp[i][j][k][flag] = ret;
}
void solve() {
  long long int n, m, k;
  cin >> n >> m >> k;
  cin >> s1 >> s2;
  memset(dp, -1, sizeof(dp));
  cout << help(0, 0, k, 0) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
