PrefPref
Practice
3.7 (51 votes)
Ad Hoc
Approved
Easy
Open
String manipulation
Two pointer
Problem
92% Success 4581 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given two string S and T. Find the maximal length of some prefix of the string S which occurs in strings T as subsequence.

Input
The first line contains string S. The second line contains string T. Both strings consist of lowecase Latin letters.

Output
Output one integer - answer to the question.

Constraints
1 <= length of S, T <= 106

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
70 votes
Tags:
ReadyMathematicsMedium
Points:20
15 votes
Tags:
AlgorithmsString ManipulationString manipulation
Points:20
14 votes
Tags:
String SearchingString AlgorithmsAlgorithms