#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T BMOD(T p, T e, T m) {
  T ret = 1;
  while (e) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
    e >>= 1;
  }
  return (T)ret;
}
template <typename T>
inline T POW(T B, T P) {
  if (P == 0) return 1;
  if (P & 1)
    return B * POW(B, P - 1);
  else
    return SQR(POW(B, P / 2));
}
template <typename T>
inline T ModInv(T b, T m) {
  return BMOD(b, m - 2, m);
}
template <typename T>
inline T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
char s1[1004], s2[1005];
int l1, l2, k, dp[1004][1004][11][2];
int go(int p1, int p2, int dv, int fl) {
  if (dv == k && fl == 0)
    return 0;
  else if (dv == k && fl == 1 && (p1 >= l1 || p2 >= l2))
    return 0;
  if (p1 >= l1 || p2 >= l2) return -1000000;
  if (dp[p1][p2][dv][fl] != -1) return dp[p1][p2][dv][fl];
  int ret = 0;
  if (s1[p1] == s2[p2]) {
    if (fl == 0) {
      ret = max(ret, (1 + go(p1 + 1, p2 + 1, dv + 1, 1)));
      ret = max(ret, (1 + go(p1 + 1, p2 + 1, dv + 1, 0)));
    } else {
      ret = max(ret, 1 + go(p1 + 1, p2 + 1, dv, fl));
      ret = max(ret, 1 + go(p1 + 1, p2 + 1, dv, 0));
    }
    ret = max(ret, go(p1 + 1, p2, dv, 0));
    ret = max(ret, go(p1, p2 + 1, dv, 0));
    ret = max(ret, go(p1 + 1, p2 + 1, dv, 0));
  } else {
    ret = max(ret, go(p1 + 1, p2, dv, 0));
    ret = max(ret, go(p1, p2 + 1, dv, 0));
    ret = max(ret, go(p1 + 1, p2 + 1, dv, 0));
  }
  return dp[p1][p2][dv][fl] = ret;
}
int main() {
  int a, b;
  scanf("%d%d%d", &a, &b, &k);
  scanf("%s%s", s1, s2);
  l1 = strlen(s1);
  l2 = strlen(s2);
  memset(dp, -1, sizeof dp);
  int ans = go(0, 0, 0, 0);
  printf("%d", ans), puts("");
  return 0;
}
