Sample in the text
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given two strings P and T, and a number k, where P is the pattern and T is the text in which we will search for P. It is known that the suffix of string T, starting at position k, is not longer than the length of string P. Perform a character-by-character comparison from left to right to determine if the pattern P is contained within the text T, starting from position k.
Input
The first line of input contains the pattern P. The second line contains the text T (1 ≤ size(T) ≤ 100). The third line contains the integer k.
Output
Print YES on the first line if the text T contains the pattern P starting from position k; otherwise, print NO. On the second line, print the number of comparisons performed.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 766
Acceptance rate 35%