#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
const int inf = 100000007;
int memo[N][N][11][2];
int n, m;
string s, t;
int dp(int i, int j, int k, int state) {
  if (i == n || j == m) {
    if (!k) return 0;
    return -inf;
  }
  int &ret = memo[i][j][k][state];
  if (ret != -1) return ret;
  ret = max(dp(i + 1, j, k, 0), dp(i, j + 1, k, 0));
  if (s[i] == t[j]) {
    if (state) ret = max(ret, 1 + dp(i + 1, j + 1, k, 1));
    if (k > 0) ret = max(ret, 1 + dp(i + 1, j + 1, k - 1, 1));
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  memset(memo, -1, sizeof memo);
  int k;
  cin >> n >> m >> k >> s >> t;
  int ret = dp(0, 0, k, 0);
  cout << ret;
}
