VK Cup 2015 - Round 2 (unofficial online mirror, Div. 1 only)
F
Encoding
Codeforces
2400
原题
← E→
翻译中…

Polycarp invented a new way to encode strings. Let's assume that we have string $*T*$, consisting of lowercase English letters. Let's choose several pairs of letters of the English alphabet in such a way that each letter occurs in at most one pair. Then let's replace each letter in $*T*$ with its pair letter if there is a pair letter for it. For example, if you chose pairs (l, r), (p, q) and (a, o), then word "parallelogram" according to the given encoding principle transforms to word "qolorreraglom".

翻译中…

Polycarpus already has two strings, $*S*$ and $*T*$. He suspects that string $*T*$ was obtained after applying the given encoding method from some substring of string $*S*$. Find all positions $*m*_{*i*}$ in $*S*$ ($1 ≤ *m*_{*i*} ≤ |*S*| - |*T*| + 1$), such that $*T*$ can be obtained fro substring $*S*_{*m*_{*i*}}*S*_{*m*_{*i*} + 1}... *S*_{*m*_{*i*} + |*T*| - 1}$ by applying the described encoding operation by using some set of pairs of English alphabet letters

翻译中…

Input

翻译中…

The first line of the input contains two integers, $|*S*|$ and $|*T*|$ ($1 ≤ |*T*| ≤ |*S*| ≤ 2·10^{5}$) — the lengths of string $*S*$ and string $*T*$, respectively.

翻译中…

The second and third line of the input contain strings $*S*$ and $*T*$, respectively. Both strings consist only of lowercase English letters.

翻译中…

Output

翻译中…

Print number $*k*$ — the number of suitable positions in string $*S*$.

翻译中…

In the next line print $*k*$ integers $*m*_{1}, *m*_{2}, ..., *m*_{*k*}$ — the numbers of the suitable positions in the increasing order.

翻译中…

样例

Input #1
11 5
abacabadaba
acaba
Output #1
3
1 3 7
InputCopy OutputCopy
Input #2
21 13
paraparallelogramgram
qolorreraglom
Output #2
1
5
InputCopy OutputCopy
题目信息
题号
533F
时间限制
3 s
内存限制
256 MB
标签
哈希
后缀结构
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。