#include <bits/stdc++.h>
using namespace std;
int dp[1010][1010][11], c[1010][1010];
char s1[1010], s2[1010];
int main() {
  int n, m, k, i, j, l;
  cin >> n >> m >> k;
  cin >> s1 + 1 >> s2 + 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (s1[i] == s2[j]) c[i][j] = c[i - 1][j - 1] + 1;
  for (l = 1; l <= k; l++)
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) {
        dp[i][j][l] = max(dp[i - 1][j][l], dp[i][j - 1][l]);
        if (c[i][j])
          dp[i][j][l] =
              max(dp[i][j][l], dp[i - c[i][j]][j - c[i][j]][l - 1] + c[i][j]);
      }
  cout << dp[n][m][k];
}
