#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
const long long INF = 2e9 + 1;
int d[N][N][12][2];
int main() {
  int n, m, k1;
  cin >> n >> m >> k1;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      for (int k = 0; k < k1 + 1; ++k)
        for (int b = 0; b < 2; ++b) {
          if (b && !d[i][j][k][b]) continue;
          d[i][j + 1][k][0] = max(d[i][j + 1][k][0], d[i][j][k][b]);
          d[i + 1][j][k][0] = max(d[i + 1][j][k][0], d[i][j][k][b]);
          if (s[i] == t[j])
            if (!b && k < k1)
              d[i + 1][j + 1][k + 1][1] =
                  max(d[i][j][k][b] + 1, d[i + 1][j + 1][k + 1][1]);
            else if (b)
              d[i + 1][j + 1][k][1] =
                  max(d[i][j][k][b] + 1, d[i + 1][j + 1][k][1]);
        }
  int ans = -INF;
  for (int i = 0; i < n + 1; ++i)
    for (int j = 0; j < m + 1; ++j)
      for (int k = 0; k < k1 + 1; ++k)
        for (int b = 0; b < 2; ++b) ans = max(ans, d[i][j][k][b]);
  cout << ans;
}
