24 hour archive: Problem
3641  A Simple Song 3641  A Simple Song 3641  A Simple Song
Statistics  Sub: 91  AC: 21  AC%: 23,08  Score: 3,57 
Created by  José Luis Castrillón Garrido 
Added by  jlcastrillon (20160523) 
Limits 
Total Time: 10000 MS

Test Time:
1000 MS
Memory: 512 MB  Output: 64 MB  Size:
16 KB

Enabled languages  
Available in 
Description
Bono is a very famous singer and this time he is worried about a new song he is composing. A song comes as a string of lowercase latin characters from 'a' to 'z'. Lets call the new song A and the last song he wrote B, the simplicity of song A is the length of the shortest substring in A that is not a substring in B. Bono has paid a lot of money to you to solve this task, given his new song A and his last song B, find the simplicity of A.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
Bono is a very famous singer and this time he is worried about a new song he is composing. A song comes as a string of lowercase latin characters from 'a' to 'z'. Lets call the new song A and the last song he wrote B, the simplicity of song A is the length of the shortest substring in A that is not a substring in B. Bono has paid a lot of money to you to solve this task, given his new song A and his last song B, find the simplicity of A.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
Bono is a very famous singer and this time he is worried about a new song he is composing. A song comes as a string of lowercase latin characters from 'a' to 'z'. Lets call the new song A and the last song he wrote B, the simplicity of song A is the length of the shortest substring in A that is not a substring in B. Bono has paid a lot of money to you to solve this task, given his new song A and his last song B, find the simplicity of A.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
A substring of a word X of length N for Bono is a subsequence (not necessary succeeding) of characters X1, X2, X3 , ..., XN.
Input specification
The first line of input contains the new song A (1 <= length(A) <= 1000). The next line contains the last song B (1 <= length(B) <= 1000). You may assume that A and B will be different strings. You may assume that A will not be a substring of B
The first line of input contains the new song A (1 <= length(A) <= 1000). The next line contains the last song B (1 <= length(B) <= 1000). You may assume that A and B will be different strings. You may assume that A will not be a substring of B
The first line of input contains the new song A (1 <= length(A) <= 1000). The next line contains the last song B (1 <= length(B) <= 1000). You may assume that A and B will be different strings. You may assume that A will not be a substring of B
Output specification
Output one line with a single integer representing the simplicity of A.
Output one line with a single integer representing the simplicity of A.
The first line of input contains the new song A (1 <= length(A) <= 1000). The next line contains the last song B (1 <= length(B) <= 1000). You may assume that A and B will be different strings. You may assume that A will not be a substring of B
Sample input
aab
baa
Sample output
2
Hint(s)
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/