#c22301. 字符串匹配例题

字符串匹配例题

String Matching Example

Problem Description

You are given two strings aa and bb, consisting only of lowercase letters. Count how many times bb occurs as a substring in aa.

There are multiple test cases. The first line is the number of test cases TT. Each test case consists of two lines: the first line is string aa, the second line is string bb.

For each test case output two lines: the first line is the number of occurrences, and the second line lists the starting index (1-based, where the first character of aa has index 1) of each occurrence. If bb does not occur, output two lines each containing −1-1.

Input Format

The first line contains an integer TT.

The following 2T2T lines each contain one string.

Output Format

Output 2T2T lines, each containing several integers. See the description above.

Sample Input

3
abababa
aba
aaaaaa
bb
abcabcab
abcab

Sample Output

3
1 3 5
-1
-1
2
1 4

Constraints

For all data: 1≤T≤101 \leq T \leq 10, 1≤∣a∣,∣b∣≤1051 \leq |a|, |b| \leq 10^5, and both strings consist only of lowercase letters.