#include <bits/stdc++.h>
using namespace std;
int n, m, k, dp[1005][1005][11][2];
bool vis[1005][1005][11][2];
string s, t;
int sol(int i, int j, int kk, bool e) {
  if (!kk && !e) return 0;
  if (i == n || j == m) return 0;
  if (vis[i][j][kk][e]) return dp[i][j][kk][e];
  vis[i][j][kk][e] = true;
  int ret = max(sol(i + 1, j, kk, 0), sol(i, j + 1, kk, 0));
  if (s[i] == t[j]) ret = max(ret, sol(i + 1, j + 1, kk - 1 + e, 1) + 1);
  return dp[i][j][kk][e] = ret;
}
int main() {
  cin >> n >> m >> k;
  cin >> s >> t;
  cout << sol(0, 0, k, 0);
  return 0;
}
