#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n, m, part;
  cin >> n >> m >> part;
  string s, t;
  cin >> s >> t;
  long long int dp[n + 1][m + 1][part + 1][2];
  memset(dp, 0, sizeof(dp));
  for (long long int i = 1; i <= n; i++)
    for (long long int j = 1; j <= m; j++)
      for (long long int k = part; k > 0; k--) {
        if (s[i - 1] == t[j - 1]) {
          dp[i][j][k][1] += dp[i - 1][j - 1][k][1];
          if (dp[i][j][k][1] or k == 1) dp[i][j][k][1]++;
          if (k + 1 <= part) {
            long long int x = dp[i][j][k + 1][1];
            dp[i][j][k + 1][1] =
                max(dp[i - 1][j - 1][k][0], dp[i - 1][j - 1][k][1]);
            if (dp[i][j][k + 1][1]) dp[i][j][k + 1][1]++;
            dp[i][j][k + 1][1] = max(x, dp[i][j][k + 1][1]);
          }
        }
        dp[i][j][k][0] = max(max(dp[i - 1][j][k][0], dp[i - 1][j][k][1]),
                             max(dp[i][j - 1][k][1], dp[i][j - 1][k][0]));
      }
  cout << max(dp[n][m][part][0], dp[n][m][part][1]);
}
