
const int N_MAX = 1002;
int N, M;
char A[N_MAX], B[N_MAX];
int f[N_MAX][N_MAX];

int main() {
  strcpy(A, "abcde");
  strcpy(B, "ace");
  N = strlen(A);
  M = strlen(B);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      // 先取 [01, 10] 两种情况的 MAX
      f[i][j] = max(f[i - 1][j], f[i][j - 1]);