#include <bits/stdc++.h>
using namespace std;
int n, m, dp[2][11][1005][1005];
string s, t;
int sol(int w, int k, int x, int y) {
  if (x == n) return 0;
  if (y == m) return 0;
  if (k == 0) return 0;
  if (dp[w][k][x][y] != -1) return dp[w][k][x][y];
  int ans = max(sol(0, k - w, x + 1, y), sol(0, k - w, x, y + 1));
  if (s[x] == t[y]) {
    ans = max(ans, 1 + sol(1, k, x + 1, y + 1));
  }
  return dp[w][k][x][y] = ans;
}
int main() {
  int k;
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof(dp));
  cout << sol(0, k, 0, 0) << endl;
  return 0;
}
