#include <bits/stdc++.h>
using namespace std;
vector<int> final_ans(10000000, 0);
vector<int> visited(10000000, 0);
string str1, str2;
int solve(int index1, int index2, int k) {
  if (k < 0) return 0;
  if (index1 < 0 || index2 < 0) return 0;
  int idk = index1 * 1000 + index2 + k * 1000000;
  if (visited[idk] != 0) return final_ans[idk];
  visited[idk] = 1;
  int temp_ans = 0;
  if (str1[index1] == str2[index2]) {
    int temp1 = index1;
    int temp2 = index2;
    int temp = 0;
    while (temp1 >= 0 && temp2 >= 0) {
      if (str1[temp1] == str2[temp2]) {
        temp++;
        temp1--;
        temp2--;
      } else {
        break;
      }
    }
    temp_ans =
        max(temp + solve(temp1, temp2, k - 1),
            max(solve(index1, index2 - 1, k), solve(index1 - 1, index2, k)));
  } else {
    temp_ans = max(solve(index1 - 1, index2, k), solve(index1, index2 - 1, k));
  }
  final_ans[idk] = temp_ans;
  return temp_ans;
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  cin >> str1 >> str2;
  int ans = solve(n - 1, m - 1, k - 1);
  printf("%d\n", ans);
  return 0;
}
