102802: [AtCoder]ABC280 C - Extra Character
Description
Score : $300$ points
Problem Statement
You are given strings $S$ and $T$. $S$ consists of lowercase English letters, and $T$ is obtained by inserting a lowercase English letter into $S$.
Find the position of the inserted character in $T$.
If there are multiple candidates, find any of them.
Constraints
- $1 \leq |S| \leq 5\times 10^5$
- $S$ consists of lowercase English letters.
- $T$ is obtained by inserting a lowercase English letter into $S$.
Input
The input is given from Standard Input in the following format:
$S$ $T$
Output
Print an integer $i$, representing that the inserted character is the $i$-th character from the beginning of $T$. If there are multiple possible answers, printing any of them is accepted.
Sample Input 1
atcoder atcorder
Sample Output 1
5
The $5$-th character from the beginning of $T$, r
, is inserted.
Sample Input 2
million milllion
Sample Output 2
5
One of the $3$-rd, $4$-th, and $5$-th characters from the beginning of $T$ is inserted. Thus, printing any one of $3$, $4$, and $5$ is accepted.
Sample Input 3
vvwvw vvvwvw
Sample Output 3
3
Input
题意翻译
给定字符串 $S,T$ 保证 $S$ 在插入一个字符后变为 $T$ ,请你求出任意一个插入字符的位置,使得插入字符后字符串 $S$变为 $T$ 。Output
问题描述
给你两个字符串$S$和$T$。$S$由小写英文字母组成,而$T$是在$S$中插入一个小写英文字母得到的。
找出插入字符在$T$中的位置。如果有多个可能的答案,找到其中一个即可。
约束条件
- $1 \leq |S| \leq 5\times 10^5$
- $S$由小写英文字母组成。
- $T$是在$S$中插入一个小写英文字母得到的。
输入
输入数据通过标准输入给出,格式如下:
$S$ $T$
输出
打印一个整数$i$,表示插入的字符是$T$中的第$i$个字符。如果有多个可能的答案,打印其中任何一个都是可以接受的。
样例输入1
atcoder atcorder
样例输出1
5
$T$中的第$5$个字符,即r
,是插入的。
样例输入2
million milllion
样例输出2
5
$T$中的第$3$个、第$4$个或第$5$个字符之一是插入的。因此,打印$3$、$4$或$5$中的任何一个都是可以接受的。
样例输入3
vvwvw vvvwvw
样例输出3
3