Naive Algorithm (First Occurrence)#8226

Naive Algorithm (First Occurrence)

1 second
64 megabytes
Very easy

Given two strings, P and T: P is the pattern, and T is the text in which we will search for P using the naive search algorithm. This involves comparing P character-by-character with each substring of T that has the same length as P.

The substrings of T are checked sequentially from left to right, and within each substring, the characters are compared from left to right. For each character comparison, the character from P that is being compared must be printed. After completing the search, output the starting position in T where the pattern P is found, or output 0 if the pattern P is not present in the text T.

Input

The first line of the input contains the pattern P (1 \leq \text{size}(P) \leq 100), and the second line contains the text T (1 \leq \text{size}(T) \leq 100).

Output

On the first line of the output, print the characters of the pattern P that are being compared. On the second line, print the position of the first occurrence of the pattern P in the text T, or 0 if the pattern is not found. Format the input and output data according to the example.

Examples

Example 1

Loading
Loading