process.stdin.resume(); process.stdin.setEncoding('utf8'); // Your code here! functin solution(S){ S = S.match(/[^w]+.*/)[0]; let ar = S.split(/(w+)/); let longest = 0; let resultIndex = []; console.log(ar); for(let i=0;ilongest){ longest = ar[i].length; resultIndex=[]; resultIndex.push(i); }else if(ar[i].length==longest){ resultIndex.push(i); } } } for(i of resultIndex){ console.log(ar[i-1]); } }