You have a blank paper strip with $$$n$$$ cells, numbered $$$1$$$ to $$$n$$$ from left to right, and a rubber stamp that prints a fixed word $$$P$$$ of length $$$k$$$.
Each stamping operation presses the rubber stamp onto the strip, printing the word $$$P$$$ across $$$k$$$ consecutive cells and overwriting any ink previously there. The stamp may partially hang off either end of the strip; any ink landing outside the strip is lost. Formally, you may place the stamp at any integer position $$$p$$$, so that for each $$$i \in \{0, 1, \dots, k-1\}$$$, if cell $$$p + i$$$ is on the strip ($$$1 \le p + i \le n$$$), it receives character $$$P[i]$$$.
Given the target string $$$T$$$ of length $$$n$$$, find the minimum number of stamps needed to make the strip exactly $$$T$$$. If it is impossible to obtain the string $$$T$$$, print $$$-1$$$.
The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^5$$$), denoting the number of test cases.
Each test case consists of three lines:
Both strings $$$T$$$ and $$$P$$$ consist only of lowercase English letters.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, print a single integer representing the minimum number of stamps needed to make the strip match $$$T$$$, or $$$-1$$$ if it is impossible.
3 5 3 abcba abc 3 3 cba abc 4 3 bbbb abc
3 3 -1
In the first test case of the sample, one optimal sequence of $$$3$$$ stamp presses is:
In the second test case of the sample, one optimal sequence of $$$3$$$ stamp presses is:
In the third test case of the sample, any stamp placing 'b' at cell $$$i$$$ simultaneously places 'a' at cell $$$i-1$$$ and 'c' at cell $$$i+1$$$, so no two adjacent cells can both be 'b'. Thus, it is impossible to produce "bbbb", and the answer is $$$-1$$$.
| Название |
|---|


