#include <bits/stdc++.h>
using namespace std;
int N, M, K;
char s[1111], t[1111];
int dp[1005][1005][11][2];
int wow(int i, int j, int k, int e) {
  if (k == 0) return 0;
  if (i < 0 || j < 0) return 0;
  if (dp[i][j][k][e] != -1) return dp[i][j][k][e];
  int &r = dp[i][j][k][e];
  if (e == 1 && s[i] == t[j]) {
    r = 1 + wow(i - 1, j - 1, k, 1);
    r = max(r, 1 + wow(i - 1, j - 1, k - 1, 0));
    return r;
  }
  if (e == 1 && s[i] != t[j]) {
    r = 0;
    return 0;
  }
  if (e == 0) {
    r = max({wow(i - 1, j, k, 1), wow(i, j - 1, k, 1), wow(i, j - 1, k, 0),
             wow(i - 1, j, k, 0)});
    return r;
  }
  r = 0;
  return r;
}
int main() {
  cin >> N >> M >> K;
  scanf("%s", s);
  scanf("%s", t);
  memset(dp, -1, sizeof(dp));
  cout << max(wow(N - 1, M - 1, K, 0), wow(N - 1, M - 1, K, 1)) << endl;
}
