306476: CF1203D1. Remove the Substring (easy version)
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Remove the Substring (easy version)
题意翻译
题目描述: **请注意:本题的简单版和困难版之间的唯一区别是字符串的长度限制。** 给你一个字符串$s$和一个字符串$t$,两者都只包含小写字母。你可以通过从$s$中删除一些字符(不必连续,可不删除)而不改变剩余字符的顺序(换句话说,删除一些字符后$t$仍然是$s$的子序列),保证最初$t$是$s$的子序列。 例如,字符串"`test`", "`tst`", "`tt`", "`et`"和""都是字符串"`test`"的子序列,而"`tset`", "`se`", "`contest`"都不是字符串"`test`"的子序列。 您希望从s中删除一些最大可能长度的连续子序列,在删除后t仍将是s的子序列。 如果要删除子串$s[l;r]$,则原字符串$s$将变化为$s_1s_2...s_{l-1}s_{r+1}s_{r+2}...s_{|s|-1}s_{|s|}$ ($|s|$为字符串$s$的长度)。 找到可以删除的连续子字符串的最大可能长度,使得删除后$t$仍将是$s$的子序列。 输入格式: 第一行包含一个由小写拉丁字母组成的字符串$s$。第二行包含一个由小写字母组成的字符串$t$。($1\leq |s|,|t|\leq 200$),保证$t$是$s$的子序列。 输出格式: 输出一个整数,即可以删除的子字符串的最大可能长度,使得$t$仍将是$s$的子序列。题目描述
The only difference between easy and hard versions is the length of the string. You are given a string $ s $ and a string $ t $ , both consisting only of lowercase Latin letters. It is guaranteed that $ t $ can be obtained from $ s $ by removing some (possibly, zero) number of characters (not necessary contiguous) from $ s $ without changing order of remaining characters (in other words, it is guaranteed that $ t $ is a subsequence of $ s $ ). For example, the strings "test", "tst", "tt", "et" and "" are subsequences of the string "test". But the strings "tset", "se", "contest" are not subsequences of the string "test". You want to remove some substring (contiguous subsequence) from $ s $ of maximum possible length such that after removing this substring $ t $ will remain a subsequence of $ s $ . If you want to remove the substring $ s[l;r] $ then the string $ s $ will be transformed to $ s_1 s_2 \dots s_{l-1} s_{r+1} s_{r+2} \dots s_{|s|-1} s_{|s|} $ (where $ |s| $ is the length of $ s $ ). Your task is to find the maximum possible length of the substring you can remove so that $ t $ is still a subsequence of $ s $ .输入输出格式
输入格式
The first line of the input contains one string $ s $ consisting of at least $ 1 $ and at most $ 200 $ lowercase Latin letters. The second line of the input contains one string $ t $ consisting of at least $ 1 $ and at most $ 200 $ lowercase Latin letters. It is guaranteed that $ t $ is a subsequence of $ s $ .
输出格式
Print one integer — the maximum possible length of the substring you can remove so that $ t $ is still a subsequence of $ s $ .
输入输出样例
输入样例 #1
bbaba
bb
输出样例 #1
3
输入样例 #2
baaba
ab
输出样例 #2
2
输入样例 #3
abcde
abcde
输出样例 #3
0
输入样例 #4
asdfasdf
fasd
输出样例 #4
3