#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int K = 15;
int n, m, k;
int dp[N][N][K][3];
char s[N], t[N];
int main() {
  scanf("%d %d %d", &n, &m, &k);
  scanf("%s %s", s + 1, t + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int l = 0; l <= k; l++) {
        if (s[i] != t[j]) {
          dp[i][j][l][0] = max(dp[i - 1][j][l][0], dp[i][j - 1][l][0]);
          if (l)
            dp[i][j][l][0] = max(dp[i][j][l][0],
                                 max(dp[i - 1][j][l][1], dp[i][j - 1][l][1]));
        } else {
          dp[i][j][l][0] = max(dp[i - 1][j][l][0], dp[i][j - 1][l][0]);
          if (l)
            dp[i][j][l][0] = max(dp[i][j][l][0],
                                 max(dp[i - 1][j][l][1], dp[i][j - 1][l][1]));
          dp[i][j][l][1] = dp[i - 1][j - 1][l][1] + 1;
          if (l)
            dp[i][j][l][1] =
                max(dp[i][j][l][1], dp[i - 1][j - 1][l - 1][0] + 1);
        }
      }
    }
  }
  cout << max(dp[n][m][k][0], dp[n][m][k][1]);
  return 0;
}
