#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  long long int x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > 1000000007) x %= 1000000007;
    }
    y = (y * y);
    if (y > 1000000007) y %= 1000000007;
    b /= 2;
  }
  return x;
}
int n, m, k;
string s, s1;
int dp[1002][1002][12][2];
int solve(int n, int m, int k, bool flag) {
  if (k < 0) {
    return INT_MIN;
  }
  if (n < 0 || m < 0) {
    if (!k) return 0;
    return INT_MIN;
  }
  int &sum = dp[n][m][k][flag];
  if (~sum) {
    return sum;
  }
  sum = 0;
  sum = max(sum, max(solve(n - 1, m, k, 0), solve(n, m - 1, k, 0)));
  if (s[n] == s1[m]) {
    sum = max(sum, 1 + solve(n - 1, m - 1, k - 1, 1));
    if (flag) {
      sum = max(sum, 1 + solve(n - 1, m - 1, k, 1));
    }
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(dp, -1, sizeof dp);
  int n, m, l;
  cin >> n >> m >> k >> s >> s1;
  cout << solve(n - 1, m - 1, k, 0) << endl;
  return 0;
}
