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