Corrupted Password
InterviewTime limit2sMemory limit1024 MB
Given strings s and t, find a position x and a character c different from s_x so that replacing s_x with c makes s a subsequence of t.
- Level
Medium5 of 10
- Topics
- Greedy, String, Two pointers
- Solved
- No attempts yet
Problem
Vi had a very important secret string . He applied the following sequence of actions to it.
- He chose a position in the string () and replaced with a character ().
- He inserted an arbitrary character at an arbitrary place in the string, zero or more times. A character can be inserted before the first character, between two adjacent characters, or after the last character.
As a result, he got the string . You are given the strings and . Help Vi recall which position and character he chose.
Input
The first line contains the string , consisting of lowercase English letters ().
The second line contains the string , consisting of lowercase English letters ().
It is guaranteed that was obtained from by the process described above.
Output
Print a position and a character that Vi could have chosen. Note that must hold. If there are multiple answers, you may print any of them.