eolymp
bolt
Try our new interface for solving problems
Problems

Satellite

Satellite

Two stations recorded the transfer from the satellite flying over them consistently, with the first station has recorded only the beginning of transmission, and the second - its end. The recordings are stored in the form of two rows of characters '\textbf{a}'..'\textbf{z}'. It is known that the recorded fragments partially overlap, ie the end of the first segment coincides with the beginning of the second, but the length of overlap is unknown. Required to find the maximum possible length of the overlap end of the first fragment with the beginning of the second. \InputFile The first line contains the information, adopted the first station, the second line - Information, adopted by the second station. The length of each row does not exceed \textbf{100 000} characters. The lines contain only lowercase letters. \OutputFile Derive the maximum possible length of the matches.
Time limit 1 second
Memory limit 64 MiB
Input example #1
abcabcba
abcbaaabc
Output example #1
5
Author Igor Andrianov