#include <bits/stdc++.h>
using namespace std;
long long int tmod(long long int x, long long int m) { return (x % m + m) % m; }
string s, t;
long long int dp[1001][1001][11][2];
long long int solve(int i, int j, int k, int end) {
  if (i == 0 || j == 0) dp[i][j][k][end] = ((k == 0) ? 0 : -1000000000);
  if (k == 0) dp[i][j][k][end] = 0;
  if (dp[i][j][k][end] == -1) {
    long long int ans = -1000000000;
    if (end) {
      if (s[i] == t[j]) {
        ans = max(ans, 1 + solve(i - 1, j - 1, k - 1, 0));
        ans = max(ans, 1 + solve(i - 1, j - 1, k, 1));
        ans = max(ans, 1 + solve(i - 1, j - 1, k - 1, 1));
      } else
        dp[i][j][k][end] = -1000000000;
    } else {
      ans = max(ans, solve(i - 1, j, k, 0));
      ans = max(ans, solve(i - 1, j, k, 1));
      ans = max(ans, solve(i, j - 1, k, 0));
      ans = max(ans, solve(i, j - 1, k, 1));
    }
    dp[i][j][k][end] = ans;
  }
  return dp[i][j][k][end];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  cin >> s >> t;
  s = '!' + s;
  t = '!' + t;
  for (int i = 0; i < 1001; i++)
    for (int j = 0; j < 1001; j++)
      for (int l = 0; l < 11; l++)
        for (int cnt = 0; cnt < 2; cnt++) dp[i][j][l][cnt] = -1;
  cout << max(solve(n, m, k, 0), solve(n, m, k, 1));
  return 0;
}
