#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 1000;
const long long mod = 1e9 + 7;
const long long hash_p1 = 1610612741;
const long long hash_p2 = 805306457;
const long long hash_p3 = 402653189;
int dp[1100][1100][11][3];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, kk;
  cin >> n >> m >> kk;
  string s1, s2;
  cin >> s1 >> s2;
  int maxn = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = 1; k <= kk; k++) {
        if (s1[i - 1] == s2[j - 1]) {
          dp[i][j][k][1] =
              max(dp[i - 1][j - 1][k][1] + 1, dp[i - 1][j - 1][k - 1][0] + 1);
        }
        dp[i][j][k][0] =
            max(max(dp[i - 1][j][k][0], dp[i][j - 1][k][0]), dp[i][j][k][1]);
      }
      maxn = max(maxn, (dp[i][j][kk][0], dp[i][j][kk][1]));
    }
  }
  int ans = max(dp[n][m][kk][0], dp[n][m][kk][1]);
  if (ans < kk) {
    cout << 0;
  } else {
    cout << ans;
  }
  return 0;
}
