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