#abc324c. C - Error Correction
C - Error Correction
Score : points
问题描述
Takahashi 向 Aoki 发送了一个由小写英文字母组成的字符串 。结果,Aoki 收到的字符串为 ,它同样由小写英文字母组成。
可能是从 修改而来的。具体来说,已知恰好满足以下四个条件之一:
- 等于 。
- 是在 中的一个位置(可能是开头或结尾)插入一个英文字母后得到的字符串。
- 是从 中删除一个字符后得到的字符串。
- 是通过将 中的一个字符更改为另一个小写英文字母得到的字符串。
给定 Aoki 收到的字符串 以及由小写英文字母组成的 个字符串 。找出其中所有可能等于 Takahashi 发送的字符串 的 中的字符串。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi sent a string consisting of lowercase English letters to Aoki. As a result, Aoki received a string consisting of lowercase English letters.
may have been altered from . Specifically, exactly one of the following four conditions is known to hold.
- is equal to .
- is a string obtained by inserting one lowercase English letter at one position (possibly the beginning and end) in .
- is a string obtained by deleting one character from .
- is a string obtained by changing one character in to another lowercase English letter.
You are given the string received by Aoki and strings consisting of lowercase English letters. Find all the strings among that could equal the string sent by Takahashi.
Constraints
- is an integer.
- and are strings of length between and , inclusive, consisting of lowercase English letters.
- The total length of is at most .
Input
The input is given from Standard Input in the following format:
Output
Let be the sequence of indices of all the strings among that could be equal to , in ascending order. Print the length of this sequence, and the sequence itself, in the following format:
Sample Input 1
5 ababc
ababc
babc
abacbc
abdbc
abbac
Sample Output 1
4
1 2 3 4
Among , the strings that could be equal to are , as explained below.
- could be equal to , because
ababc
is equal toababc
. - could be equal to , because
ababc
is obtained by inserting the lettera
at the beginning ofbabc
. - could be equal to , because
ababc
is obtained by deleting the fourth characterc
fromabacbc
. - could be equal to , because
ababc
is obtained by changing the third characterd
inabdbc
tob
. - could not be equal to , because if we take
abbac
as , thenababc
does not satisfy any of the four conditions in the problem statement.
Sample Input 2
1 aoki
takahashi
Sample Output 2
0
Sample Input 3
9 atcoder
atoder
atcode
athqcoder
atcoder
tacoder
jttcoder
atoder
atceoder
atcoer
Sample Output 3
6
1 2 4 7 8 9
update @ 2024/3/10 01:46:03