#include <bits/stdc++.h>
using namespace std;
const int maxn = 1007;
char st1[1111], st2[1111];
int dp[maxn][maxn][15][2];
int main() {
  int n, m, k;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    memset(dp, 0, sizeof(dp));
    scanf("%s", st1 + 1);
    scanf("%s", st2 + 1);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (st1[i] == st2[j]) {
          for (int l = 1; l <= k; l++) {
            dp[i][j][l][0] =
                max(dp[i - 1][j - 1][l][0], dp[i - 1][j - 1][l - 1][1]) + 1;
          }
        }
        for (int l = 1; l <= k; l++) {
          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;
}
