#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18;
long long int dp[1010][1010][12][2];
bool vis[1010][1010][12][2];
string s, t;
int lenS, lenT, k;
long long int f(int i, int j, int k, int flag) {
  if (i == lenS or j == lenT) {
    if (k > 1 or (k == 1 and !flag)) return -inf;
    if (k == 0 or (k == 1 and flag)) return 0;
  }
  if (k == 0) return 0;
  if (vis[i][j][k][flag]) return dp[i][j][k][flag];
  vis[i][j][k][flag] = 1;
  if (flag) {
    long long int op1 = f(i, j, k - 1, 0);
    long long int op2 = -inf;
    if (s[i] == t[j]) op2 = 1 + f(i + 1, j + 1, k, 1);
    return dp[i][j][k][flag] = max(op1, op2);
  }
  long long int op1 = -inf, op2 = -inf, op3 = -inf;
  if (s[i] == t[j]) op1 = f(i + 1, j + 1, k, 1) + 1;
  op2 = f(i + 1, j, k, 0);
  op3 = f(i, j + 1, k, 0);
  return dp[i][j][k][flag] = max(op1, max(op2, op3));
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> lenS >> lenT >> k;
  cin >> s >> t;
  cout << f(0, 0, k, 0) << "\n";
}
