#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 1;
inline long long input(void) {
  char t;
  long long x = 0;
  int neg = 0;
  t = getchar();
  while ((t < 48 || t > 57) && t != '-') t = getchar();
  if (t == '-') {
    neg = 1;
    t = getchar();
  }
  while (t >= 48 && t <= 57) {
    x = (x << 3) + (x << 1) + t - 48;
    t = getchar();
  }
  if (neg) x = -x;
  return x;
}
inline void output(long long x) {
  char a[20];
  int i = 0, j;
  a[0] = '0';
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x == 0) putchar('0');
  while (x) {
    a[i++] = x % 10 + 48;
    x /= 10;
  }
  for (j = i - 1; j >= 0; j--) {
    putchar(a[j]);
  }
  putchar('\n');
}
int dp[1002][1002][11][2];
char s[1002], t[1002];
int main() {
  long long n, m, v;
  memset(dp, 0, sizeof(dp));
  n = input();
  m = input();
  v = input();
  scanf("%s%s", s + 1, t + 1);
  for (int i = 1; i < n + 1; ++i)
    for (int j = 1; j < m + 1; ++j)
      for (int k = 1; k < v + 1; ++k)
        for (int x = 1; x >= 0; x--) {
          if (s[i] == t[j]) {
            if (x)
              dp[i][j][k][x] = max(dp[i - 1][j - 1][k][x] + 1,
                                   dp[i - 1][j - 1][k - 1][!x] + 1);
            else
              dp[i][j][k][0] = max(dp[i][j][k][1],
                                   max(dp[i - 1][j][k][x], dp[i][j - 1][k][x]));
          } else {
            if (x)
              dp[i][j][k][x] = 0;
            else
              dp[i][j][k][x] = max(dp[i - 1][j][k][x], dp[i][j - 1][k][x]);
          }
        }
  output(dp[n][m][v][0]);
  return 0;
}
