Two lines
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given two strings, A and B, your task is to find all the positions where string B appears as a substring within string A.
Input
The first line of input contains the string A with a length between 1 and 10^5
. The second line contains the string B, also with a length between 1 and 10^5
.
Output
On the first line, print the total number of times string B occurs as a substring in string A. On the second line, print the starting positions of each occurrence in ascending order, separated by spaces. Follow the format shown in the example for input and output.
Examples
Input #1
Answer #1
Submissions 985
Acceptance rate 18%