#include <bits/stdc++.h>
using namespace std;
long long int modpow(long long int a, long long int n, long long int temp) {
  long long int res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
int dp[1001][1001][11][2];
int main() {
  int n, m, K;
  cin >> n >> m >> K;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < m; ++i) {
    if (t[i] == s[0]) dp[0][i][1][1] = 1;
    if (i > 0) dp[0][i][1][0] = max(dp[0][i - 1][1][0], dp[0][i - 1][1][1]);
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] == t[0]) dp[i][0][1][1] = 1;
    if (i > 0) dp[i][0][1][0] = max(dp[i - 1][0][1][0], dp[i - 1][0][1][1]);
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < m; ++j) {
      for (int k = 1; k <= K; ++k) {
        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][0], dp[i][j - 1][k][1]));
      }
      if (s[i] == t[j]) {
        for (int k = 1; k <= K; ++k) {
          dp[i][j][k][1] =
              1 + max(dp[i - 1][j - 1][k - 1][0], dp[i - 1][j - 1][k - 1][1]);
          if (s[i - 1] == t[j - 1])
            dp[i][j][k][1] = max(dp[i][j][k][1], 1 + dp[i - 1][j - 1][k][1]);
        }
      }
    }
  }
  cout << max(dp[n - 1][m - 1][K][0], dp[n - 1][m - 1][K][1]) << endl;
  return 0;
}
