#include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1e+9 + 7;
const ll INF = LLONG_MAX;
const int N = (int)1e+3 + 8;
ll n, m, k, g;
string second, t;
ll dp[N][N][11][2];
ll solve(ll i, ll j, ll k, ll first) {
  if ((first == 0 && k == g) || i > n || j > m) return 0;
  if (dp[i][j][k][first] != -1) return dp[i][j][k][first];
  ll ans = -INF;
  ans = max(ans, solve(i + 1, j, k, 0));
  ans = max(ans, solve(i, j + 1, k, 0));
  if (second[i] == t[j]) {
    if (first == 0)
      ans = max(ans, solve(i + 1, j + 1, k + 1, 1) + 1);
    else
      ans = max(ans, solve(i + 1, j + 1, k, 1) + 1);
  }
  return dp[i][j][k][first] = ans;
}
void MAIN(int tc) {
  cin >> n >> m >> g;
  cin >> second >> t;
  second = "#" + second + "#";
  ;
  t = "#" + t + "#";
  ;
  memset(dp, -1, sizeof(dp));
  cout << solve(1, 1, 0, 0) << "\n";
  ;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed;
  cout << setprecision(10);
  int test_cases = 1;
  for (int i = 1; i <= test_cases; i++) {
    MAIN(i);
  }
}
