```js function solve(str) { var maxStr = '', tmpStr = ''; var hashed = {}; for (const c of str) { if (!hashed[c]) { hashed[c] = true; tmpStr += c; } else { if (tmpStr.length > maxStr.length) { maxStr = tmpStr; tmpStr = c; } } } return maxStr; } ```