A9782 | Encoding
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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_{mi}S_{mi}+1...\ S_{mi}+|T|-1$ by applying the described encoding operation by using some set of pairs of English alphabet letters
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_{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|$ 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.
The second and third line of the input contain strings $S$ and $T$ , respectively. Both strings consist only of lowercase English letters.
输出格式
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.
In the next line print $k$ integers $m_{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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted