#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1005, maxk = 12;
string s, t;
long long d[maxn][maxn][maxk][2];
long long n, m, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k >> s >> t;
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= m; j++) {
      for (long long z = 0; z <= k; z++) {
        long long temp = max(d[i][j][z][0], d[i][j][z][1]);
        d[i + 1][j][z][0] = max(d[i + 1][j][z][0], temp);
        d[i][j + 1][z][0] = max(d[i][j + 1][z][0], temp);
        if (s[i] == t[j]) {
          d[i + 1][j + 1][z + 1][1] =
              max(d[i + 1][j + 1][z + 1][1], d[i][j][z][0] + 1);
          if (z > 0) {
            d[i + 1][j + 1][z][1] =
                max(d[i + 1][j + 1][z][1], d[i][j][z][1] + 1);
          }
        }
      }
    }
  }
  cout << *max_element(d[n][m][0], d[n][m][k] + 2) << endl;
}
