#include <bits/stdc++.h>
using namespace std;
long long int dp[1003][1003][12][2];
long long int n, m, k;
string s1, s2;
long long int recursively_approach1(long long int index1, long long int index2,
                                    long long int rem, long long int counti) {
  if (index1 == n || index2 == m) {
    return ((rem == 0) ? 0 : INT_MIN);
  }
  if (rem == 0) {
    return 0;
  }
  if (dp[index1][index2][rem][counti] != -1) {
    return dp[index1][index2][rem][counti];
  }
  long long int ret = INT_MIN;
  ret = max(ret, recursively_approach1(index1 + 1, index2, rem - counti, 0));
  ret = max(ret, recursively_approach1(index1, index2 + 1, rem - counti, 0));
  if (s1[index1] == s2[index2]) {
    ret = max(ret, 1 + recursively_approach1(index1 + 1, index2 + 1, rem, 1));
    ret =
        max(ret, 1 + recursively_approach1(index1 + 1, index2 + 1, rem - 1, 0));
  }
  return dp[index1][index2][rem][counti] = ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m >> k;
  cin >> s1;
  cin >> s2;
  memset(dp, -1, sizeof dp);
  cout << recursively_approach1(0, 0, k, 0) << endl;
  return 0;
}
