You are given two strings *a* and *b*. You have to remove the minimum possible number of consecutive (standing one after another) characters from string *b* in such a way that it becomes a subsequence of string *a*. It can happen that you will not need to remove any characters at all, or maybe you will have to remove all of the characters from *b* and make it empty.

Subsequence of string *s* is any such string that can be obtained by erasing zero or more characters (not necessarily consecutive) from string *s*.
The first line contains string *a*, and the second line — string *b*. Both of these strings are nonempty and consist of lowercase letters of English alphabet. The length of each string is no bigger than 10<sup class="upper-index">5</sup> characters.
In the first example strings *a* and *b* don't share any symbols, so the longest string that you can get is empty.

In the second example ac is a subsequence of *a*, and at the same time you can obtain it by erasing consecutive symbols cepted from string *b*.
hi
bob
-
abca
accepted
ac
abacaba
abcdcba
abcba
lo
euhaqdhhzlnkmqnakgwzuhurqlpmdm
-
aaeojkdyuilpdvyewjfrftkpcobhcumwlaoiocbfdtvjkhgda
mlmarpivirqbxcyhyerjoxlslyfzftrylpjyouypvk
ouypvk
npnkmawey
areakefvowledfriyjejqnnaeqheoh
a
fdtffutxkujflswyddvhusfcook
kavkhnhphcvckogqqqqhdmgwjdfenzizrebefsbuhzzwhzvc
kvc
abacaba
aa
aa
edbcd
d
d
abc
ksdksdsdsnabc
abc
abxzxzxzzaba
aba
aba
abcd
zzhabcd
abcd
aa
aa
aa
test
t
t
aa
a
a
aaaabbbbaaaa
aba
aba
aa
zzaa
aa
zhbt
ztjihmhebkrztefpwty
zt
aaaaaaaaaaaaaaaaaaaa
aaaaaaaa
aaaaaaaa
abba
aba
aba
abbba
aba
aba
aaaaaaaaaaaa
aaaaaaaaaaaa
aaaaaaaaaaaa
aaa
aa
aa
aaaaaaaaaaaa
aaa
aaa
aaaaabbbbbbaaaaaa
aba
aba
ashfaniosafapisfasipfaspfaspfaspfapsfjpasfshvcmvncxmvnxcvnmcxvnmxcnvmcvxvnxmcvxcmvh
ashish
ashish
a
a
a
aaaab
aab
aab
aaaaa
aaaa
aaaa
a
aaa
a
aaaaaabbbbbbaaaaaa
aba
aba
def
abcdef
def
aaaaaaaaa
a
a
bababsbs
abs
abs
hddddddack
hackyz
hack
aba
a
a
ofih
ihfsdf
ih
b
abb
b
lctsczqr
qvkp
q
dedcbaa
dca
dca
haddack
hack
hack
abcabc
abc
abc
asdf
gasdf
asdf
abab
ab
ab
aaaaaaa
aaa
aaa
asdf
fasdf
asdf
bbaabb
ab
ab
accac
baacccbcccabaabbcacbbcccacbaabaaac
aac
az
aaazazaa
a
bbacaabbaaa
acaabcaa
acaabaa
c
cbcbcbbacacacbccaaccbcabaaabbaaa
c
bacb
ccacacbacbccbbccccaccccccbcbabbbaababa
ba
ac
aacacaacbaaacbbbabacaca
a
a
zazaa
a
abcd
faaaabbbbccccdddeda
a
abcde
fabcde
abcde
a
ab
a
ababbbbbbbbbbbb
abbbbb
abbbbb
bbbbaabbababbaaaaababbaaabbbbaaabbbababbbbabaabababaabaaabbbabababbbabababaababaaaaa
bbabaaaabaaaabbaaabbbabaaabaabbbababbbbbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab
bbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab
ab
aba
ab
aa
aaaa
aa
aaaaabbbaaaaa
aabbaa
aabbaa
aaaaaaaaa
aaaa
aaaa
abbcc
aca
ac
b
cb
b
aac
aaa
aa
ba
bb
b
a
b
-
gkvubrvpbhsfiuyha
ihotmn
ih
ccccabccbb
cbbabcc
cabcc
babababbaaabb
abbab
abbab
njtdhyqundyedsjyvy
ypjrs
ys
uglyqhkpruxoakm
cixxkpaaoodpuuh
uh
a
aaaaaaaaa
a
aaa
aaaaa
aaa
abcabbcbcccbccbbcc
acbcaabbbbcabbbaca
acbc
caacacaacbaa
acbbbabacacac
aacacac
aa
aaab
aa
acbc
cacacbac
ac
bacbcaacabbaacb
cbbaaccccbcaacacaabb
cbcaabb
baababaaaab
baababbbbbbb
baababb
aaxyaba
aaba
aaba
class word:
    def __init__(self,strin):
        self.palabra=strin
    def countLetter(self,letter):
        return self.palabra.count(letter)
    def letterBelongTo(self,letter):
        return letter in self.palabra

stringa=input()
stringb=input()


word1=word(stringa)
word2=word(stringb)
staticword=word2.palabra
count=0
j=0
while count!=len(staticword):
    i=staticword[count]
    if word1.letterBelongTo(i)==False or word2.countLetter(i)>word1.countLetter(i):
        word2.palabra=word2.palabra[:count-j]+word2.palabra[count-j+1:]
        j+=1
    count+=1
if len(word2.palabra)==0: word2.palabra="-"
print(word2.palabra)