#include <bits/stdc++.h>
using namespace std;
const int MAX = 1004;
int n, m, k, inf = 1005;
string s, t;
int memo[MAX][MAX][12][2];
int solve(int x, int y, int cont, int flag) {
  if (x == n || y == m)
    if (cont == k)
      return 0;
    else
      return -inf;
  int& ans = memo[x][y][cont][flag];
  if (ans != -1) return ans;
  ans = 0;
  if (s[x] == t[y]) {
    if (flag) ans = max(ans, 1 + solve(x + 1, y + 1, cont, 1));
    if (cont < k) ans = max(ans, 1 + solve(x + 1, y + 1, cont + 1, 1));
  }
  ans = max(ans, solve(x + 1, y, cont, 0));
  ans = max(ans, solve(x, y + 1, cont, 0));
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(memo, -1, sizeof(memo));
  cout << solve(0, 0, 0, 0) << '\n';
  return 0;
}
