#P10976. 统计重复个数
统计重复个数
Problem Description
Define to mean that is formed by concatenating the string exactly times.
For example, . If we can delete some characters from to make it become , then we say that the string can be obtained from the string .
For example, by definition, can be obtained from , by only deleting the characters marked in red.
Now you are given two strings and , and two integers and . Based on them, we construct two strings: and .
Please find the maximum integer such that can be obtained from .
Input Format
This problem contains multiple test cases. There are at most test cases.
For each test case, there are two lines:
- The first line contains the string and the integer .
- The second line contains the string and the integer .
Output Format
For each test case, output the integer as the answer.
ab 2
acb 4
acb 1
acb 1
2
1
Hint
The testdata guarantees that and consist only of lowercase letters, and , . For each test point, there are no more than test cases.
Translated by ChatGPT 5