JavaScript (ES6), 8181 74 bytes
f=
s=>s.replace(/(?=(.+)\1)/g,(_,m)=>(n=m=>r=m[r.length)>l&&(l=n,r=m)length]?m:r,l=0r='')&&s.replace(r,'')
<input oninput=o.textContent=f(this.value,r='')><pre id=o>
TheEdit: Saved 7 bytes by stealing @Arnauld's ,r=''m[r.length]
prevents the function crashing on invalid inputtrick.