Shortest Substring Containing a Subsequence

Let S and T be character strings. We say that S is a subsequence of T if the characters that comprise S appear in the same order within T, but not necessarily adjacent to one another.  For example, MOO is a subsequence of NONMONOTONIC, because the letters M, O, and O appear within NONMONOTONIC as the fourth, fifth, and seventh letters, respectively.  However, POT is neither a subsequence of LIFTS nor of ATROPHY. In the first case, not all of the letters in POT appear in LIFTS; in the second case, although all the letters of POT are present in ATROPHY, they are not in the proper order.

You are to develop a program that takes as input a sequence of pairs of character strings. Each line will contain a single string of length no more than 40. (Thus, the first pair of strings appears on lines 1 and 2, the second pair on lines 3 and 4, etc., etc.) For each pair of strings S and T, your program is to report whether or not S is a subsequence of T. If it is not, your program should simply print "NO"; if it is, your program should print the starting and ending positions of the shortest substring of T containing S as a subsequence. (Positions are numbered from left to right starting at 0.) If there are two or more shortest substrings of T containing S as a subsequence, identify the leftmost such substring.

Sample Input

ben
aboekneno
pelth
dgiephwrtlx
sss
tstststsstst

Sample Output

1 5 
NO 
5 8