#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int mem[1005][1005][15][2];
char a[1005];
char b[1005];
int f(int x, int y, int cnt, int now) {
  int ans;
  if (cnt > k) return -1 << 30;
  if (x == n && y == m) {
    if (cnt) return 0;
    return -1 << 30;
  }
  if (mem[x][y][cnt][now] == -1) {
    ans = -1 << 30;
    if (x < n) ans = max(ans, f(x + 1, y, cnt, 0));
    if (y < m) ans = max(ans, f(x, y + 1, cnt, 0));
    if (x < n && y < m && a[x] == b[y]) {
      ans = max(ans, 1 + f(x + 1, y + 1, cnt + 1, 1));
      if (now) ans = max(ans, 1 + f(x + 1, y + 1, cnt, 1));
    }
    mem[x][y][cnt][now] = ans;
  }
  return mem[x][y][cnt][now];
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  scanf(" %s %s", a, b);
  memset(mem, -1, sizeof(mem));
  printf("%d", f(0, 0, 0, 0));
}
