#P8703. [蓝桥杯 2019 国 B] 最优包含

    ID: 9632 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 显示难度普及 上传者: 标签>动态规划 DP2019蓝桥杯国赛

[蓝桥杯 2019 国 B] 最优包含

Problem Description

We say that a string SS contains a string TT if TT is a subsequence of SS. That is, we can pick some characters from SS, and keep their original order to form a new string that is exactly the same as TT.

Given two strings SS and TT, find the minimum number of characters in SS that need to be modified so that SS contains TT.

Input Format

Input consists of two lines, each containing a string. The string on the first line is SS, and the string on the second line is TT. Both strings are non-empty and contain only uppercase English letters.

Output Format

Output one integer, which is the answer.

ABCDEABCD
XAABZ

3

Hint

For 20%20\% of the test cases, 1TS201 \leq |T| \leq |S| \leq 20.

For 40%40\% of the test cases, 1TS1001 \leq |T| \leq |S| \leq 100.

For all test cases, 1TS10001 \leq |T| \leq |S| \leq 1000.

Lanqiao Cup 2019 National Contest, Group B, Problem F.

Translated by ChatGPT 5