#include <bits/stdc++.h>
using namespace std;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const long long NLINF = 0xf7f7f7f7f7f7f7f7;
const int INF = 0x3f3f3f3f, NINF = 0xf7f7f7f7;
const int MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
const int N = 1e3 + 10;
int n, m, k, dp[N][N][15][2];
char s[N], t[N];
int f(int i, int j, int l, bool b) {
  if (i == n + 1 or j == m + 1) return (!l ? 0 : -INF);
  if (dp[i][j][l][b] != -1) return dp[i][j][l][b];
  int r = 0;
  if (s[i] == t[j]) {
    if (b)
      r = max(r, max(f(i + 1, j + 1, l, 1) + 1, f(i + 1, j + 1, l, 0) + 1));
    if (l) r = max(r, f(i + 1, j + 1, l - 1, 1) + 1);
    r = max(r, f(i + 1, j + 1, l, 0));
  }
  r = max(r, max(f(i + 1, j, l, 0), f(i, j + 1, l, 0)));
  return dp[i][j][l][b] = r;
}
int main() {
  scanf("%d%d%d %s %s", &n, &m, &k, s + 1, t + 1);
  memset(dp, -1, sizeof dp);
  printf("%d\n", f(1, 1, k, 0));
}
