#include <bits/stdc++.h>
using namespace std;
int f[1005][1005][11][2];
string s, t;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, i = 1, j, k, l;
  cin >> n >> m >> k >> s >> t;
  for (; i <= n; ++i)
    for (j = 1; j <= m; ++j)
      for (l = 1; l <= k; ++l) {
        if (s[i - 1] == t[j - 1])
          f[i][j][l][1] =
              max(f[i - 1][j - 1][l - 1][0], f[i - 1][j - 1][l][1]) + 1;
        f[i][j][l][0] =
            max(f[i][j][l][1], max(f[i - 1][j][l][0], f[i][j - 1][l][0]));
      }
  cout << f[n][m][k][0];
}
