#include <bits/stdc++.h>
using namespace std;
const int N = 1007;
int n, m, K;
string a, b;
int dp[N][N];
int pd[N][N];
int main() {
  cin >> n >> m >> K;
  cin >> a >> b;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i - 1] == b[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
    }
  }
  for (int k = 1; k <= K; k++) {
    for (int i = n; i >= 1; i--) {
      for (int j = m; j >= 1; j--) {
        if (min(i, j) >= dp[i][j])
          pd[i][j] = max(pd[i][j], pd[i - dp[i][j]][j - dp[i][j]] + dp[i][j]);
        else
          pd[i][j] = max(pd[i][j], dp[i][j]);
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        pd[i][j] = max(pd[i][j], max(pd[i - 1][j], pd[i][j - 1]));
      }
    }
  }
  cout << pd[n][m] << '\n';
  return 0;
}
