#include <bits/stdc++.h>
using namespace std;
int n, m, k;
string s, t;
int dp[1005][1005][12][2];
int solve(int idx, int idt, int rem, int conti) {
  if (idx == n or idt == m) {
    return ((rem == 0) ? 0 : INT_MIN);
  }
  if (rem == 0) return 0;
  if (dp[idx][idt][rem][conti] != -1) return dp[idx][idt][rem][conti];
  int ans = INT_MIN;
  ans = max(ans, solve(idx + 1, idt, rem - conti, 0));
  ans = max(ans, solve(idx, idt + 1, rem - conti, 0));
  if (s[idx] == t[idt]) {
    ans = max(ans, 1 + solve(idx + 1, idt + 1, rem - 1, 0));
    ans = max(ans, 1 + solve(idx + 1, idt + 1, rem, 1));
  }
  return dp[idx][idt][rem][conti] = ans;
}
int main() {
  cin >> n >> m >> k;
  cin >> s >> t;
  memset(dp, -1, sizeof(dp));
  cout << solve(0, 0, k, 0);
  return 0;
}
