#include <bits/stdc++.h>
const long long mod = 1000000007L;
using namespace std;
int n, m, K;
string s, t;
int dp[1005][1005][12][2];
inline int solve(int i, int j, int k, bool pref) {
  if (i == n || j == m) return 0;
  if (dp[i][j][k][pref] != -1) return dp[i][j][k][pref];
  int ans = 0;
  if (s[i] == t[j]) {
    if (pref) {
      ans = max(ans, 1 + solve(i + 1, j + 1, k, pref));
    } else if (k >= 1) {
      ans = max(ans, 1 + solve(i + 1, j + 1, k - 1, 1));
    }
  }
  ans = max(ans, solve(i + 1, j, k, 0));
  ans = max(ans, solve(i, j + 1, k, 0));
  dp[i][j][k][pref] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> K;
  cin >> s >> t;
  memset((dp), -1, sizeof((dp)));
  cout << solve(0, 0, K, 0) << endl;
  return 0;
}
