#include <bits/stdc++.h>
using namespace std;
const int MAX = 1001;
int n, m, x;
int adp[MAX][MAX][11][2];
string s1, s2;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m >> x >> s1 >> s2;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = 1; k <= x; ++k) {
        adp[i][j][k][0] = max(max(adp[i - 1][j][k][0], adp[i - 1][j][k][1]),
                              max(adp[i][j - 1][k][0], adp[i][j - 1][k][1]));
        if (s1[i - 1] == s2[j - 1])
          adp[i][j][k][1] =
              max(adp[i - 1][j - 1][k][1] + 1, adp[i - 1][j - 1][k - 1][0] + 1);
      }
  cout << max(adp[n][m][x][0], adp[n][m][x][1]);
  return 0;
}
