#include <bits/stdc++.h>
using namespace std;
int dp[1005][1005][20][3];
char s[1004], s1[1004];
int main() {
  int n, m, k;
  int i;
  scanf("%d%d%d", &n, &m, &k);
  getchar();
  for (i = 1; i <= n; i++) {
    scanf("%c", &s[i]);
  }
  getchar();
  for (i = 1; i <= m; i++) {
    scanf("%c", &s1[i]);
  }
  memset(dp, 0, sizeof(dp));
  for (i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i] == s1[j]) {
        for (int t = 1; t <= k; t++) {
          dp[i][j][t][1] = max(dp[i - 1][j - 1][t - 1][0] + 1, dp[i][j][t][1]);
          dp[i][j][t][1] = max(dp[i][j][t][1], dp[i - 1][j - 1][t][1] + 1);
          dp[i][j][t][0] = max(dp[i - 1][j - 1][t][1] + 1, dp[i][j][t][0]);
          dp[i][j][t][0] = max(dp[i - 1][j - 1][t - 1][0] + 1, dp[i][j][t][0]);
        }
      }
      for (int t = 1; t <= k; t++) {
        dp[i][j][t][0] = max(dp[i - 1][j][t][0], dp[i][j][t][0]);
        dp[i][j][t][0] = max(dp[i][j][t][0], dp[i - 1][j - 1][t][0]);
        dp[i][j][t][0] = max(dp[i][j][t][0], dp[i][j - 1][t][0]);
      }
    }
  }
  printf("%d\n", dp[n][m][k][0]);
}
