#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
int dp[1010][1010][12][2];
int main() {
  int K, m, n;
  char a[1010];
  char b[1010];
  while (scanf("%d%d%d", &m, &n, &K) != EOF) {
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        if (a[i] == b[j]) {
          for (int k = 1; k <= K; k++) {
            dp[i][j][k][0] =
                max(dp[i - 1][j - 1][k][0], dp[i - 1][j - 1][k - 1][1]) + 1;
          }
        }
        for (int k = 1; k <= K; k++) {
          dp[i][j][k][1] = max(max(dp[i - 1][j - 1][k][1], dp[i - 1][j][k][1]),
                               max(dp[i][j - 1][k][1], dp[i][j][k][0]));
        }
      }
    }
    cout << dp[m][n][K][1] << endl;
  }
  return 0;
}
