#include <bits/stdc++.h>
using namespace std;
int n, m, k, dp[1001][1001][11][2];
char s[1001], t[1001];
void setup() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int j = 1; j <= m; j++) cin >> t[j];
}
void xuly() {
  for (int q = 1; q <= k; q++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        dp[i][j][q][0] = max(dp[i - 1][j][q][0], dp[i][j - 1][q][0]);
        dp[i][j][q][0] = max(dp[i][j][q][0], dp[i - 1][j][q][1]);
        dp[i][j][q][0] = max(dp[i][j][q][0], dp[i][j - 1][q][1]);
        if (s[i] == t[j])
          dp[i][j][q][1] =
              max(dp[i - 1][j - 1][q][1], dp[i - 1][j - 1][q - 1][0]) + 1;
      }
  int ans = 0;
  for (int i = 1; i <= k; i++)
    for (int j = 0; j <= 1; j++) ans = max(ans, dp[n][m][i][j]);
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  setup();
  xuly();
  return 0;
}
