MSTRING - String problem

Substring of some string A is defined as one or more (not necessarily consecutive) elements of the string while maintaining the order.

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

Input:
banana 
anbnaanbaan 
 
Output:
5
(e.g. banna)
Input:
babab 
babba 
 
Output:
3
(e.g. aab)

Được gửi lên bởi:psetter
Ngày:2009-02-28
Thời gian chạy:1s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET
Nguồn bài:COI 04

hide comments
2020-03-31 15:33:41
nếu xâu a = xâu b thì sao?
2020-03-28 09:27:09
khoai :v
2014-09-29 15:46:10 Lollipop
ngắn nhất sao k phải là =0 @@
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.