#include <bits/stdc++.h>
using namespace std;
string s, t;
int n, m, k;
int dp[11][1003][1003][2] = {};
int find(int p, int i, int j, bool cont) {
  if (p == 0)
    return 0;
  else if (i >= n || j >= m)
    return -2e9;
  else if (dp[p][i][j][cont] == -1) {
    dp[p][i][j][cont] = -2e9;
    dp[p][i][j][cont] =
        max(find(p - cont, i + 1, j, false), find(p - cont, i, j + 1, false));
    if (s[i] == t[j]) {
      dp[p][i][j][cont] =
          max(dp[p][i][j][cont], 1 + find(p, i + 1, j + 1, true));
      dp[p][i][j][cont] =
          max(dp[p][i][j][cont], 1 + find(p - 1, i + 1, j + 1, false));
    }
  }
  return dp[p][i][j][cont];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof(dp));
  cout << find(k, 0, 0, false);
  return 0;
}
