#include <bits/stdc++.h>
using namespace std;
int dp[1010][1010][11][2];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  int kk = k;
  string a, b;
  cin >> a >> b;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (a[i - 1] == b[j - 1]) {
        for (int k = 1; k <= kk; ++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 <= kk; ++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]));
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= k; ++i) {
    ans = max(ans, dp[n][m][i][1]);
  }
  cout << ans << endl;
  return 0;
}
