#include <bits/stdc++.h>
using namespace std;
void Print(int _x) { printf("%d\n", _x); }
void Print(long long _x) { printf("%lld\n", _x); }
template <typename T>
void Print(T _a[], int _s, int _t) {
  for (int i = _s; i <= _t; i++) cout << _a[i] << " ";
  cout << endl;
}
struct InputReader {
  static const int bs = 100000;
  char buf[bs];
  int p;
  inline InputReader() : p(bs) {}
  inline void Flush() {
    p = 0;
    fread(buf, 1, bs, stdin);
  }
  inline char C() {
    if (p >= bs) Flush();
    return buf[p++];
  }
  int Getnum() {
    char ch = C();
    while (ch < '0' || ch > '9') ch = C();
    return (int)(ch - '0');
  }
  inline int operator()() {
    int ans = 0;
    char ch = C();
    int fu = 1;
    while (ch < '0' || ch > '9') {
      if (ch == '-') fu = -1;
      ch = C();
    }
    while (ch >= '0' && ch <= '9') {
      ans *= 10;
      ans += ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  long long Readll() {
    long long ans = 0LL;
    long long fu = 1;
    char ch = C();
    while (ch < '0' || ch > '9') {
      if (ch == '-') fu = -1;
      ch = C();
    }
    while (ch >= '0' && ch <= '9') {
      ans *= 10LL;
      ans += ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  inline void Readstring(string &x) {
    x.clear();
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch)) ch = C();
    while (isdigit(ch) || isalpha(ch)) {
      x += ch;
      ch = C();
    }
  }
  inline void Readalpha(char &c) {
    c = C();
    while (!isalpha(c)) c = C();
  }
  inline void Specialread(char &c) {
    c = C();
    while (c != 'o' && c != 'x' && c != '?') c = C();
  }
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
  x = In();
  y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
  x1 = In();
  x2 = In();
  x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
  x1 = In();
  x2 = In();
  x3 = In();
  x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
  x = In.Readll();
  y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
  x4 = In.Readll();
}
clock_t _starttime, _endtime;
inline void FILEIO() {}
inline void END() { exit(0); }
int n, m, k;
string s, t;
int mem[1010][1010][12][3];
inline int Dfs(int x, int y, int leftk, bool insub) {
  if (mem[x][y][leftk][insub] != -1) return mem[x][y][leftk][insub];
  if (!leftk) return 0;
  if (x > n || y > m) {
    if (insub && leftk <= 1) return 0;
    return -(0x3f3f3f3f);
  }
  int ans = -(0x3f3f3f3f);
  if (!insub) {
    if (s[x] == t[y])
      if (ans < Dfs(x + 1, y + 1, leftk, 1) + 1)
        ans = Dfs(x + 1, y + 1, leftk, 1) + 1;
    ;
    if (ans < Dfs(x + 1, y, leftk, 0)) ans = Dfs(x + 1, y, leftk, 0);
    ;
    if (ans < Dfs(x, y + 1, leftk, 0)) ans = Dfs(x, y + 1, leftk, 0);
    ;
  } else {
    if (s[x] == t[y]) {
      if (ans < Dfs(x + 1, y + 1, leftk, 1) + 1)
        ans = Dfs(x + 1, y + 1, leftk, 1) + 1;
      ;
      if (ans < Dfs(x + 1, y + 1, leftk - 1, 1) + 1)
        ans = Dfs(x + 1, y + 1, leftk - 1, 1) + 1;
      ;
    }
    if (ans < Dfs(x + 1, y, leftk - 1, 0)) ans = Dfs(x + 1, y, leftk - 1, 0);
    ;
    if (ans < Dfs(x, y + 1, leftk - 1, 0)) ans = Dfs(x, y + 1, leftk - 1, 0);
    ;
  }
  return mem[x][y][leftk][insub] = ans;
}
int main() {
  FILEIO();
  memset(mem, -1, sizeof(mem));
  Read(n, m, k);
  In.Readstring(s);
  s = " " + s;
  In.Readstring(t);
  t = " " + t;
  int ans = Dfs(1, 1, k, 0);
  printf("%d\n", ans);
  END();
}
