#include <bits/stdc++.h>
using namespace std;
const long long N = 1005;
const long long M = 12;
const long long SQ = 320;
const long long INF = 1e9;
const long long MOD = 1e9 + 7;
int n, m, k;
string s, t;
int dp[2][M][N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  cin >> s >> t;
  for (int i = 1; i <= k; i++) dp[0][i][n][m] = dp[1][i][n][m] = -INF;
  for (int i = n; i >= 0; i--)
    for (int j = m; j >= 0; j--) {
      if (i == n && j == m) continue;
      for (int p = 0; p <= k; p++)
        for (int r = 0; r < 2; r++) {
          if (i < n) dp[r][p][i][j] = max(dp[r][p][i][j], dp[0][p][i + 1][j]);
          if (j < m) dp[r][p][i][j] = max(dp[r][p][i][j], dp[0][p][i][j + 1]);
          if ((p != 0 || r == 1) && i < n && j < m && s[i] == t[j]) {
            if (r == 0)
              dp[r][p][i][j] =
                  max(dp[r][p][i][j], dp[1][p - 1][i + 1][j + 1] + 1);
            else {
              if (p != 0)
                dp[r][p][i][j] =
                    max(dp[r][p][i][j], dp[1][p - 1][i + 1][j + 1] + 1);
              dp[r][p][i][j] = max(dp[r][p][i][j], dp[1][p][i + 1][j + 1] + 1);
            }
          }
        }
    }
  cout << dp[0][k][0][0] << endl;
  return 0;
}
