CF533F.Encoding
提高+/省选-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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
Polycarp 发明了一种新的字符串编码方法。假设我们有一个由小写英文字母组成的字符串 T。我们选择若干对英文字母,使得每个字母至多出现在其中一对中。然后,对于 T 中的每个字母,若其存在配对字母,则将其替换为该配对字母。例如,若你选择了配对 (l,r)、(p,q) 和 (a,o),则根据上述编码规则,单词 “parallelogram” 将被转换为 “qolorreraglom”。
Polycarpus 已经拥有两个字符串 S 和 T。他怀疑字符串 T 是通过对字符串 S 的某个子串应用上述编码方法得到的。请找出所有满足条件的位置 mi(1≤mi≤∣S∣−∣T∣+1),使得通过选取某组英文字母配对,可将 S 中从位置 mi 开始、长度为 ∣T∣ 的子串 SmiSmi+1…Smi+∣T∣−1 编码为 T。
输入格式
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.
输入的第一行包含两个整数 ∣S∣ 和 ∣T∣(1 ≤ ∣T∣ ≤ ∣S∣ ≤ 2⋅105),分别表示字符串 S 和字符串 T 的长度。
输入的第二行和第三行分别包含字符串 S 和 T。两个字符串均由小写英文字母组成。
输出格式
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.
输出整数 k —— 字符串 S 中合适位置的个数。
在下一行输出 k 个整数 _m_₁, _m_₂, ..., m__k —— 按升序排列的合适位置的编号。
输入输出样例
输入#1
11 5 abacabadaba acaba
输出#1
3 1 3 7
输入#2
21 13 paraparallelogramgram qolorreraglom
输出#2
1 5
输入解题思路,AI测评打分。不知道怎么写?