#include <bits/stdc++.h>
using namespace std;
char s1[1010], s2[1010];
int dp[1010][1010][15][2], n, m, k;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  scanf("%s%s", s1, s2);
  for (int i = 1; i <= k; i++) {
    for (int j1 = 1; j1 <= n; j1++) {
      for (int j2 = 1; j2 <= m; j2++) {
        if (s1[j1 - 1] == s2[j2 - 1]) {
          dp[j1][j2][i][1] = 1 + max(dp[j1 - 1][j2 - 1][i][1],
                                     max(dp[j1 - 1][j2 - 1][i - 1][0],
                                         dp[j1 - 1][j2 - 1][i - 1][1]));
        }
        dp[j1][j2][i][0] = max(dp[j1 - 1][j2][i][1], dp[j1 - 1][j2][i][0]);
        dp[j1][j2][i][0] = max(max(dp[j1][j2 - 1][i][1], dp[j1][j2 - 1][i][0]),
                               dp[j1][j2][i][0]);
      }
    }
  }
  int ans = max(dp[n][m][k][1], dp[n][m][k][0]);
  printf("%d", ans);
  return 0;
}
