trivago Interview Question

Remove duplicate words from a string in JS