跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1700. Encoding

    ID: 1706 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>哈希后缀结构字符串数据结构挑战难度共享题库Codeforces英文题面题目来源题面语言

Encoding

题目描述

F. Encoding
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 mi in S (1≤mi≤|S|-|T|+1), such that T can be obtained fro substring SmiSmi+1... Smi+|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·105) − 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 m1,m2,...,mk − the numbers of the suitable positions in the increasing order.

Examples
Input
11 5
abacabadaba
acaba
Output
3
1 3 7
Input
21 13
paraparallelogramgram
qolorreraglom
Output
1
5

题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1242 题。保留原作者与原赛事署名。