read s
read t
ls=${#s}
lt=${#t}
min=$lt
echo $t | fold -1 | nl > f2
for i in `seq 0 $((ls-lt))`
do
    echo ${s:i:lt} | fold -1 | nl > f1
    c=$((`cat f1 f2 | sort -u | wc -l`-lt))
    min=$((min<c?min:c))
done
echo $min