#include <bits/stdc++.h>
using namespace std;
const int MAX = 100009;
int dp[1001][1001][12];
int n, m, k;
string s, t;
int solve(int i, int j, int cnt) {
  if (i == n || j == m || cnt == 0) return 0;
  int &ret = dp[i][j][cnt];
  if (ret != -1) return ret;
  ret = 0;
  ret = max(ret, solve(i + 1, j, cnt));
  ret = max(ret, solve(i, j + 1, cnt));
  int x = i;
  int y = j;
  for (; x < n && y < m;) {
    if (s[x] != t[y])
      break;
    else {
      ++x;
      ++y;
    }
  }
  if (x > i) ret = max(ret, x - i + solve(x, y, cnt - 1));
  return ret;
}
int main() {
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0, k);
  return 0;
}
