shunfurh
编程介的小学生
采纳率92.7%
2017-04-17 16:33 阅读 747
已采纳

Keep Deleting

Assume that string A is the substring of string B if and only if we can find A in B, now we have a string A and another string B, your task is to find a A in B from B's left side to B's right side, and delete it from B till A is not a substring of B, then output the number of times you do the delete.

There are only letters(A-Z, a-z) in string A and B.

Input

This problem contains multiple test cases. Each case contains two line, the first line is string A, the second line is string B, the length of A is less than 256, the length of B is less than 512000.

Output

Print exactly one line with the number of times you do the delete for each test case.

Sample Input

abcd
abcabcddabcdababcdcd
Sample Output

5
Hint

abcabcddabcdababcdcd delete=0
abcdabcdababcdcd delete=1
abcdababcdcd delete=2
ababcdcd delete=3
abcd delete=4
delete=5

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

相关推荐