#include <bits/stdc++.h>
using namespace std;
int dp[1001][1001][11][2];
int n, m, k;
string s, t;
int myfind(int i, int j, int till, int status) {
  if (dp[i][j][till][status] == -1) {
    int t1, t2, t3, t4;
    int ans = 0;
    if (till == k)
      ans = 0;
    else if (i == n)
      ans = -1200;
    else if (j == m)
      ans = -1200;
    else {
      if (status == 1) {
        if (s[i] == t[j]) {
          t1 = myfind(i + 1, j + 1, till, status);
          t2 = myfind(i + 1, j + 1, till + 1, 0);
          t3 = myfind(i + 1, j + 1, till + 1, 1);
          ans = 1 + max(max(t1, t2), t3);
        } else
          ans = -1200;
      } else {
        t1 = myfind(i, j + 1, till, 0);
        t2 = myfind(i, j + 1, till, 1);
        t3 = myfind(i + 1, j, till, 0);
        t4 = myfind(i + 1, j, till, 1);
        ans = max(max(t1, t2), max(t3, t4));
      }
    }
    dp[i][j][till][status] = ans;
  }
  return dp[i][j][till][status];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m >> k;
  cin >> s >> t;
  int i, j, k, l, ans;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= m; j++) {
      for (k = 0; k < 11; k++) {
        for (l = 0; l < 2; l++) dp[i][j][k][l] = -1;
      }
    }
  }
  ans = max(myfind(0, 0, 0, 0), myfind(0, 0, 0, 1));
  cout << ans << endl;
  return 0;
}
