CF476E.Dreamoon and Strings

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dreamoon has a string ss and a pattern string pp . He first removes exactly xx characters from ss obtaining string ss' as a result. Then he calculates that is defined as the maximal number of non-overlapping substrings equal to pp that can be found in ss' . He wants to make this number as big as possible.

More formally, let's define as maximum value of over all ss' that can be obtained by removing exactly xx characters from ss . Dreamoon wants to know for all xx from 00 to s|s| where s|s| denotes the length of string ss .

输入格式

The first line of the input contains the string ss ( 1<=s<=20001<=|s|<=2000 ).

The second line of the input contains the string pp ( 1<=p<=5001<=|p|<=500 ).

Both strings will only consist of lower case English letters.

输出格式

Print s+1|s|+1 space-separated integers in a single line representing the for all xx from 00 to s|s| .

输入输出样例

  • 输入#1

    aaaaa
    aa
    

    输出#1

    2 2 1 1 0 0
    
  • 输入#2

    axbaxxb
    ab
    

    输出#2

    0 1 1 2 1 1 0 0
    

说明/提示

For the first sample, the corresponding optimal values of ss' after removal 00 through s=5|s|=5 characters from ss are {"aaaaa", "aaaa", "aaa", "aa", "a", ""}.

For the second sample, possible corresponding optimal values of ss' are {"axbaxxb", "abaxxb", "axbab", "abab", "aba", "ab", "a", ""}.

首页