#include <bits/stdc++.h>
using namespace std;
int const N = 1e3 + 10, K = 10 + 2, E = -(1e8 + 10);
long long dp[N][N][K][2];
int n, m, kk;
string s, t;
void read_input() {
  cin >> n >> m >> kk;
  cin >> s >> t;
}
void solve() {
  s = '*' + s, t = '*' + t;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = 1; k <= kk; k++) {
        dp[i][j][k][1] = (s[i] == t[j] ? 1 + max(dp[i - 1][j - 1][k][1],
                                                 dp[i - 1][j - 1][k - 1][0])
                                       : 0);
        dp[i][j][k][0] =
            max({dp[i - 1][j][k][0], dp[i][j - 1][k][0], dp[i][j][k][1]});
      }
  cout << dp[n][m][kk][0];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  read_input(), solve();
  return 0;
}
