#include <bits/stdc++.h>
using namespace std;
const int block_size = 320;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
const int inf = mod;
const double PI = atan(1) * 4;
template <typename T>
inline int sign(const T &a) {
  if (a < 0) return -1;
  if (a > 0) return 1;
  return 0;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int maxn = 1010;
int dp[maxn][maxn][11];
char s[2][maxn];
int match[maxn][maxn], len[2], k;
int main() {
  cin >> len[0] >> len[1] >> k;
  scanf("%s %s", s[0] + 1, s[1] + 1);
  for (long long i = 1; i < len[0] + 1; i++) {
    for (long long j = 1; j < len[1] + 1; j++) {
      if (s[0][i] == s[1][j]) {
        match[i][j] = match[i - 1][j - 1] + 1;
      }
    }
  }
  for (long long i = 1; i < len[0] + 1; i++) {
    for (long long j = 1; j < len[1] + 1; j++) {
      for (long long cnt = 1; cnt < k + 1; cnt++) {
        dp[i][j][cnt] =
            max({dp[i - match[i][j]][j - match[i][j]][cnt - 1] + match[i][j],
                 dp[i - 1][j][cnt], dp[i][j - 1][cnt]});
      }
    }
  }
  int ans = 0;
  for (long long cnt = 1; cnt < k + 1; cnt++) {
    ans = max(ans, dp[len[0]][len[1]][cnt]);
  }
  cout << ans;
  return 0;
}
