#include <bits/stdc++.h>
using namespace std;
const int nax = 1e3 + 5;
int n, m, K;
string s, t;
int dp[nax][nax][11][3];
int go(int i, int j, int k, int flag) {
  if (i == n || j == m) return 0;
  int& ans = dp[i][j][k][flag];
  if (ans != -1) return ans;
  ans = -1e9;
  if (s[i] == t[j]) {
    if (flag) {
      ans = max(ans, go(i + 1, j + 1, k, flag) + 1);
      ans = max(ans, go(i + 1, j + 1, k, 0) + 1);
    } else {
      if (k - 1 >= 0) ans = max(ans, go(i + 1, j + 1, k - 1, 1) + 1);
    }
  }
  if (i + 1 <= n) ans = max(ans, go(i + 1, j, k, 0));
  if (j + 1 <= m) ans = max(ans, go(i, j + 1, k, 0));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  memset(dp, -1, sizeof dp);
  cin >> n >> m >> K;
  cin >> s >> t;
  cout << go(0, 0, K, 0) << endl;
  return 0;
}
