#include <bits/stdc++.h>
using namespace std;
int n, m, d, dp[1005][1005][15][2];
string s, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> d >> s >> t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = 1; k <= d; k++) {
        if (s[i - 1] == t[j - 1]) {
          if (i > 1 && j > 1 && s[i - 2] == t[j - 2] &&
              (k == 1 || dp[i - 1][j - 1][k][1])) {
            dp[i][j][k][1] = dp[i - 1][j - 1][k][1] + 1;
          }
          if (k == 1 || dp[i - 1][j - 1][k - 1][0]) {
            dp[i][j][k][1] =
                max(dp[i][j][k][1], dp[i - 1][j - 1][k - 1][0] + 1);
            dp[i][j][k][1] =
                max(dp[i][j][k][1], dp[i - 1][j - 1][k - 1][1] + 1);
          }
        }
        dp[i][j][k][0] = max(dp[i - 1][j][k][0], dp[i][j - 1][k][0]);
        dp[i][j][k][0] = max(dp[i][j][k][0], dp[i - 1][j][k][1]);
        dp[i][j][k][0] = max(dp[i][j][k][0], dp[i][j - 1][k][1]);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= d; i++) {
    ans = max(ans, max(dp[n][m][i][0], dp[n][m][i][1]));
  }
  cout << ans << '\n';
  return 0;
}
