Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 300 点
問題文
文字列 S,T が与えられます。S は英小文字からなり、T は S に英小文字を 1 つ挿入して作られたことがわかっています。
挿入された文字は T の先頭から何番目の文字であるか求めてください。
複数の候補が考えられる場合はいずれか 1 つを求めてください。
制約
- 1 \leq |S| \leq 5\times 10^5
- S は英小文字からなる
- T は S に英小文字を 1 つ挿入して作られた文字列である
入力
入力は以下の形式で標準入力から与えられる。
S T
出力
答えを出力せよ。なお、答えが複数考えられる場合はどれを出力しても正解となる。
入力例 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
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