← 返回 amazon 的题目列表Maximum Times Word Removed
类型:online_judge
amazon
Given a sentence composed of lowercase letters and a word. Your task is to determine how many times the complete word can be removed from the sentence. The requirements are:
Each removal of the word requires the characters to be adjacent in the string.
Write a function to compute the maximum number of times the word can be removed from the sentence.
Input
A string sentence, with length ranging [1, 1000]
A string word, with length ranging [1, 100]
Output
An integer representing the maximum number of times the word can be removed from the sentence.
Example
Input:
sentence = "ababcababc"
word = "abc"
Output:
2
Example
Input
ababcababc
abc