a,b,e=raw_input(),raw_input(),"" while b: i=p=0 while i<99 and p>=0:q,p=p,a.find(b[:i]);i+=1 e+=b[:i-2].strip()+"...";a=a[q:];b=b[i-2:] print e[:-3]