#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int dp[maxn][maxn][12][2];
char s[maxn], t[maxn];
int main() {
  int n, m, kk;
  scanf("%d %d %d", &n, &m, &kk);
  scanf("%s", s + 1);
  scanf("%s", t + 1);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i] == t[j]) {
        for (int k = 1; k <= kk; ++k) {
          dp[i][j][k][0] =
              max(dp[i - 1][j - 1][k - 1][1], dp[i - 1][j - 1][k][0]) + 1;
          dp[i][j][k][1] = max(
              dp[i][j][k][1],
              max(dp[i][j][k][0], max(dp[i - 1][j][k][1], dp[i][j - 1][k][1])));
        }
      } else {
        for (int k = 1; k <= kk; ++k)
          dp[i][j][k][1] = max(max(dp[i - 1][j][k][1], dp[i][j][k][1]),
                               max(dp[i][j - 1][k][1], dp[i - 1][j - 1][k][1]));
      }
    }
  }
  printf("%d\n", dp[n][m][kk][1]);
  return 0;
}
