103521: [Atcoder]ABC352 B - Typing
Description
Score: $200$ points
Problem Statement
Takahashi tried to type a string $S$ consisting of lowercase English letters using a keyboard.
He was typing while looking only at the keyboard, not the screen.
Whenever he mistakenly typed a different lowercase English letter, he immediately pressed the backspace key. However, the backspace key was broken, so the mistakenly typed letter was not deleted, and the actual string typed was $T$.
He did not mistakenly press any keys other than those for lowercase English letters.
The characters in $T$ that were not mistakenly typed are called correctly typed characters.
Determine the positions in $T$ of the correctly typed characters.
Constraints
- $S$ and $T$ are strings of lowercase English letters with lengths between $1$ and $2 \times 10^5$, inclusive.
- $T$ is a string obtained by the procedure described in the problem statement.
Input
The input is given from Standard Input in the following format:
$S$ $T$
Output
Let $|S|$ be the length of $S$. If the correctly typed characters are the $A_1$-th, $A_2$-th, $\ldots$, $A_{|S|}$-th characters of $T$, print the values of $A_1, A_2, \ldots, A_{|S|}$ in this order, separated by spaces.
Ensure that the output is in ascending order. That is, $A_i < A_{i + 1}$ should hold for each $1 \leq i \leq |S| - 1$.
Sample Input 1
abc axbxyc
Sample Output 1
1 3 6
The sequence of Takahashi's typing is as follows:
- Type
a
. - Try to type
b
but mistakenly typex
. - Press the backspace key, but the character is not deleted.
- Type
b
. - Try to type
c
but mistakenly typex
. - Press the backspace key, but the character is not deleted.
- Try to type
c
but mistakenly typey
. - Press the backspace key, but the character is not deleted.
- Type
c
.
The correctly typed characters are the first, third, and sixth characters.
Sample Input 2
aaaa bbbbaaaa
Sample Output 2
5 6 7 8
Sample Input 3
atcoder atcoder
Sample Output 3
1 2 3 4 5 6 7
Takahashi did not mistakenly type any characters.
Input
Output
问题描述
高桥君试图用键盘输入一个由小写英文字母组成的字符串$S$。
他在看键盘而不是屏幕的情况下打字。
每当他误打了一个不同的小写字母时,他都会立即按下退格键。然而,退格键坏了,所以误打的字母没有被删除,实际输入的字符串是$T$。
他没有误按除小写字母外的任何其他键。
在$T$中没有被误打的字符被称为正确输入的字符。
确定$T$中正确输入字符的位置。
限制条件
- $S$和$T$是长度在$1$到$2 \times 10^5$之间(含)的小写英文字母字符串。
- $T$是按照问题描述中的过程得到的字符串。
输入
输入数据从标准输入给出,格式如下:
$S$ $T$
输出
令$|S|$为$S$的长度。如果正确输入的字符是$T$中的第$A_1$个,第$A_2$个,$\ldots$,第$A_{|S|}$个字符,按照顺序打印$A_1, A_2, \ldots, A_{|S|}$的值,用空格分隔。
确保输出是升序的。即对于每个$1 \leq i \leq |S| - 1$,$A_i < A_{i + 1}$应成立。
样例输入1
abc axbxyc
样例输出1
1 3 6
高桥君打字的顺序如下:
- 输入
a
。 - 尝试输入
b
但误输入x
。 - 按下退格键,但字符没有被删除。
- 输入
b
。 - 尝试输入
c
但误输入x
。 - 按下退格键,但字符没有被删除。
- 尝试输入
c
但误输入y
。 - 按下退格键,但字符没有被删除。
- 输入
c
。
正确输入的字符是第一个,第三个和第六个字符。
样例输入2
aaaa bbbbaaaa
样例输出2
5 6 7 8
样例输入3
atcoder atcoder
样例输出3
1 2 3 4 5 6 7
高桥君没有误打任何字符。