#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int n, m, k, np[1010][1010], dp[11][1010][1010], v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  cin >> s1 >> s2;
  for (int a = 0; a < s1.size(); a++) {
    for (int b = 0; b < s2.size(); b++) {
      if (s1[a] == s2[b])
        np[a + 1][b + 1] = np[a][b] + 1;
      else
        np[a + 1][b + 1] = 0;
      dp[1][a + 1][b + 1] =
          max(max(np[a][b + 1], np[a + 1][b]), max(np[a][b], np[a + 1][b + 1]));
      dp[1][a + 1][b + 1] = max(max(dp[1][a][b + 1], dp[1][a + 1][b]),
                                max(dp[1][a][b], dp[1][a + 1][b + 1]));
    }
  }
  for (int a = 0; a < s1.size(); a++) {
    for (int b = 0; b < s2.size(); b++) {
      for (int c = 2; c <= k; c++) {
        v = np[a + 1][b + 1];
        if (s1[a] == s2[b]) {
          dp[c][a + 1][b + 1] = max(max(dp[c][a][b + 1], dp[c][a + 1][b]),
                                    max(dp[c][a][b], dp[c - 1][a][b] + 1));
          dp[c][a + 1][b + 1] =
              max(dp[c][a + 1][b + 1], dp[c - 1][a - v + 1][b - v + 1] + v);
        } else
          dp[c][a + 1][b + 1] =
              max(max(dp[c][a][b + 1], dp[c][a + 1][b]), max(dp[c][a][b], -1));
      }
    }
  }
  cout << dp[k][s1.size()][s2.size()];
  return 0;
}
