#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int dp[N][N][11][2];
int n, m, k;
char s[N], t[N];
int max(int a, int b) { return (a > b ? a : b); }
void input() {
  cin >> n >> m >> k;
  scanf("%s", s + 1);
  scanf("%s", t + 1);
}
void solve() {
  for (int i = 1; i <= (n); i++)
    for (int j = 1; j <= (m); j++)
      for (int l = 1; l <= (k); l++) {
        if (s[i] == t[j])
          dp[i][j][l][1] =
              max(dp[i - 1][j - 1][l][0], dp[i - 1][j - 1][l - 1][1]) + 1;
        dp[i][j][l][0] = max(max(dp[i - 1][j][l][0], dp[i - 1][j][l][1]),
                             max(dp[i][j - 1][l][1], dp[i][j - 1][l][1]));
      }
}
void output() { cout << max(dp[n][m][k][0], dp[n][m][k][1]); }
int main() {
  input();
  solve();
  output();
  return 0;
}
