#include <bits/stdc++.h>
using namespace std;
bool cmp(int x, int y) { return x > y; }
const int N = 1e3 + 2;
int dp[2][N][N], maxs[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  string s, t;
  cin >> s >> t;
  s = '-' + s;
  t = '+' + t;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (s[i] == t[j]) maxs[i][j] = maxs[i - 1][j - 1] + 1;
  for (int l = 1; l <= k; l++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        int now = l & 1;
        dp[now][i][j] = max(dp[now][i - 1][j], dp[now][i][j - 1]);
        if (s[i] == t[j])
          (dp[now][i][j]) =
              max((dp[now][i][j]),
                  (dp[1 - now][i - maxs[i][j]][j - maxs[i][j]] + maxs[i][j]));
      }
  cout << dp[k & 1][n][m];
  return 0;
}
