#include <bits/stdc++.h>
using namespace std;
int n, m, k, dp[1005][1005][15][2];
char s[1005], t[1005];
int main() {
  cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 1; i <= m; i++) cin >> t[i];
  memset(dp, 0, sizeof(dp));
  for (int j = 1; j <= n; j++) {
    for (int l = 1; l <= m; l++) {
      for (int i = 1; i <= k; i++) {
        if (s[j] == t[l]) {
          dp[j][l][i][1] = max(
              max(dp[j - 1][l - 1][i - 1][0] + 1, dp[j - 1][l - 1][i][1] + 1),
              dp[j][l][i][1]);
        }
        for (int o = 0; o <= 1; o++)
          dp[j][l][i][0] =
              max(max(dp[j][l - 1][i][o], dp[j - 1][l][i][o]), dp[j][l][i][0]);
      }
    }
  }
  cout << max(dp[n][m][k][0], dp[n][m][k][1]);
}
