#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int YY[] = {-1, 0, 1, -1, 1, -1, 0, 1};
long long int n, m, k;
string s, t;
long long int dp[1005][1005][12][2];
long long int func(long long int i, long long int j, long long int count,
                   long long int end) {
  if (i >= n || j >= m) {
    if (count == k) return 0;
    return INT_MIN;
  }
  if (dp[i][j][count][end] != -1) return dp[i][j][count][end];
  long long int maxi = 0;
  maxi = max(maxi, func(i + 1, j, count, 0));
  maxi = max(maxi, func(i, j + 1, count, 0));
  if (s[i] == t[j]) {
    if (end == 0) {
      if (count < k) maxi = max(maxi, 1 + func(i + 1, j + 1, count + 1, 1));
    } else {
      maxi = max(maxi, func(i + 1, j + 1, count, 1) + 1);
      if (count < k) maxi = max(maxi, func(i + 1, j + 1, count + 1, 1) + 1);
    }
  }
  return dp[i][j][count][end] = maxi;
}
int main() {
  memset(dp, -1, sizeof(dp));
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int i, j;
  cin >> n >> m >> k;
  cin >> s >> t;
  long long int ans = func(0, 0, 0, 0);
  cout << ans;
}
