I like playing game with my friends, although sometimes look pretty naive. Today I invent a new game called find black hand. The game is not about catching bad people but playing on a string.
Now I generate a string S and several short ones s[i], and I define three kinds of operations.
1. Delete: remove the ith character.
2. Insert: in any position, insert a character if you like.
3. Change: change the ith character into another character if you like.
For each short string s[i], we define a function f(i). After several operations on S, we can find a substring of S which is the same to s[i]. And f(i) is the minimal number of operations to achieve. It looks so native that I think every one of you can solve f(i) perfectly. So I join the string S from end to end, and f(i) changes nothing. So the string "bb" is also a substring of string "baaab".
The "black hand" is the short string s[i] whose f(i) is minimal. Now it's your time to find the black hand.