#include <bits/stdc++.h>
using namespace std;
char buff[1010];
string s1, s2;
int dp[1005][1005][15][2];
int main() {
  int n, m, K;
  scanf("%d%d%d", &n, &m, &K);
  scanf("%s", buff);
  s1 = buff;
  scanf("%s", buff);
  s2 = buff;
  for (int i = 0; i < 1005; i++)
    for (int j = 0; j < 1005; j++)
      for (int k = 0; k < 15; k++)
        for (int f = 0; f < 2; f++) {
          if (k == K && !f)
            dp[i][j][k][f] = 0;
          else
            dp[i][j][k][f] = -2000;
        }
  for (int k = K - 1; k >= 0; k--) {
    for (int i = n - 1; i >= 0; i--) {
      for (int j = m - 1; j >= 0; j--) {
        if (s1[i] == s2[j])
          dp[i][j][k][1] =
              max(dp[i + 1][j + 1][k][1], dp[i + 1][j + 1][k + 1][0]) + 1;
        dp[i][j][k][0] = max(dp[i + 1][j][k][0], dp[i][j + 1][k][0]);
        if (s1[i] == s2[j]) {
          int cons =
              max(dp[i + 1][j + 1][k][1], dp[i + 1][j + 1][k + 1][0]) + 1;
          dp[i][j][k][0] = max(dp[i][j][k][0], cons);
        }
      }
    }
  }
  int res = dp[0][0][0][0];
  printf("%d\n", res);
}
