Electronic scoreboard
The new coded lock for netbook owners presents a challenge not only for thieves but also for the owners themselves. The lock's display continuously shows a sequence of zeros and ones. The lock will open when a specific combination appears on the display. To transform the current combination into the required one, you can press the buttons labeled 0 and 1 in the correct order.
Pressing the button labeled 0 shifts the current combination on the display one position to the right (the rightmost digit disappears), and a 0 is added to the leftmost position. Similarly, pressing the button labeled 1 shifts the combination to the right, but a 1 is added to the leftmost position.
You are given the current sequence of digits displayed and the sequence needed to unlock the lock. Your task is to help the netbook owner determine the minimum number of button presses required to achieve the desired combination.
Input
The first line contains the current sequence of digits, and the second line contains the target sequence needed to unlock the lock. Both sequences are guaranteed to be non-empty, have the same length not exceeding 100,000, and consist solely of zeros and ones. The digits in each line are written consecutively without spaces.
Output
Output the minimum number of button presses required to solve the problem.