#MSTRING. String problem
String problem
English | Vietnamese |
Substring of some string A is defined as one or more (not necessary succeeding) elements of the string with maintaining the sequence.
There are given two strings, string VOKI and string TOKI. Write the program that will calculate the length of any shortest substring of string VOKI such as it is not substring of string TOKI.
Input
In first line of input file there is string VOKI and in second one is string TOKI. The only characters that will occur are lowercase characters of English alphabet (‘a’- ‘z’). String lengths will be less or equal to 1000.
Note: input data will be such so there will always be a solution.
Output
In the first line of file you should print the length of wanted substring.
Sample
Sample input</p>banana anbnaanbaan
Sample output
5
(eg. banna)
Sample input
babab babba
Sample output
3
(eg. aab)