#include <bits/stdc++.h>
using namespace std;
char a[1010], b[1010];
int dp[1010][1010][11][2];
int n, m, k;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", a + 1, b + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int l = 1; l <= k; l++) {
        if (a[i] == b[j])
          dp[i][j][l][0] =
              max(dp[i - 1][j - 1][l][0], dp[i - 1][j - 1][l - 1][1]) + 1;
        dp[i][j][l][1] = max(max(dp[i - 1][j - 1][l][1], dp[i - 1][j][l][1]),
                             max(dp[i][j - 1][l][1], dp[i][j][l][0]));
      }
  printf("%d\n", dp[n][m][k][1]);
  return 0;
}
