#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007ll;
int dp[1005][1005][12][2], len1, len2;
char str1[1005];
char str2[1005];
int func(int i, int j, int k, int f) {
  if (k < 0) return -10000000;
  if (i >= len1 || j >= len2) return 0;
  int& res = dp[i][j][k][f];
  if (res != -1) return res;
  res = 0;
  if (str1[i] == str2[j]) {
    res = func(i + 1, j + 1, k - f, 0) + 1;
    res = max(res, func(i + 1, j + 1, k - f, 1) + 1);
  }
  res = max(res, func(i + 1, j, k, 1));
  res = max(res, func(i, j + 1, k, 1));
  return res;
}
int main() {
  int k;
  scanf("%d %d %d", &len1, &len2, &k);
  scanf("%s", str1);
  scanf("%s", str2);
  memset(dp, -1, sizeof dp);
  printf("%d\n", func(0, 0, k, 1));
  return 0;
}
