CF533F.Encoding

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarp invented a new way to encode strings. Let's assume that we have string TT , 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 TT 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, SS and TT . He suspects that string TT was obtained after applying the given encoding method from some substring of string SS . Find all positions mim_{i} in SS ( 1<=mi<=ST+11<=m_{i}<=|S|-|T|+1 ), such that TT can be obtained fro substring SmiSmi+1... Smi+T1S_{mi}S_{mi}+1...\ S_{mi}+|T|-1 by applying the described encoding operation by using some set of pairs of English alphabet letters

输入格式

The first line of the input contains two integers, S|S| and T|T| ( 1<=T<=S<=21051<=|T|<=|S|<=2·10^{5} ) — the lengths of string SS and string TT , respectively.

The second and third line of the input contain strings SS and TT , respectively. Both strings consist only of lowercase English letters.

输出格式

Print number kk — the number of suitable positions in string SS .

In the next line print kk integers m1,m2,...,mkm_{1},m_{2},...,m_{k} — the numbers of the suitable positions in the increasing order.

输入输出样例

  • 输入#1

    11 5
    abacabadaba
    acaba
    

    输出#1

    3
    1 3 7
    
  • 输入#2

    21 13
    paraparallelogramgram
    qolorreraglom
    

    输出#2

    1
    5
    
首页