#include <bits/stdc++.h>
using namespace std;
string s, t;
int dp[1001][1001][11][2];
int rec(int i, int j, int left, bool last = 0) {
  if (j >= (int)t.size() || i >= (int)s.size()) return 0;
  if (dp[i][j][left][last] != -1) return dp[i][j][left][last];
  int ans = 0;
  if (s[i] == t[j] && (left > 0 || last)) {
    if (last) ans = max(ans, 1 + rec(i + 1, j + 1, left, 1));
    if (left > 0) ans = max(ans, 1 + rec(i + 1, j + 1, left - 1, 1));
  }
  ans = max(ans, rec(i + 1, j, left, 0));
  ans = max(ans, rec(i, j + 1, left, 0));
  return dp[i][j][left][last] = ans;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof dp);
  cout << rec(0, 0, k);
}
