当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3489:Necklace

题目描述
Henryy gave the princess of the kingdom of Henryy a necklace, which is made by a series of diamonds which are the most valuable among the world.
The necklace can be regarded as a string of diamonds. (Notice that it’s not a loop of them!) In the kingdom, another kind of necklace is very popular, but it is much less precious. If this kind of necklace is a sub-string (not sub-sequence) of the princess’, maybe somebody will use the fake one to replace a part of it, and this is quite dangerous. Thus, Henryy want to remove some of the diamonds off from the necklace to make it safer. This number, of course, should be as small as possible.
输入解释
The first line contains an integer T (1 ≤ T ≤ 10) which means T test cases follow:
In each test case:
The first line is a string indicating the princess’ necklace with its length no more than 10000 and made up by characters from ‘a’ to ‘z’.
The second line is the common necklace, with its length no more than 1000 and also made up by characters from ‘a’ to ‘z’.
The two necklaces cannot be reversed. (For example, a necklace “abc” cannot be regarded as “cba”.)
A blank line is followed after each test case.
输出解释
For each test case, output an integer, the least diamonds that has to be removed.
输入样例
1
ababaa
aba
输出样例
1
来自杭电HDUOJ的附加信息
Recommend zhouzeyong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3489

最后修改于 2020-10-25T23:04:04+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
3000/1000MS(Java/Others) 65535/65535K(Java/Others)