process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function(chunk) { main(chunk.trim()); }); function main(chunk){ // your code goes here var words = []; var pool = ""; var w_cnt = 0; var max_length = 0; for(var i in chunk){ if(chunk[i]=='w'){ w_cnt++; if(pool!="") words.push({word:pool}); pool = ""; }else{ if(w_cnt > 0 && words[words.length-1]){ words[words.length-1].length = w_cnt; } max_length = Math.max(max_length,w_cnt); pool += chunk[i]; w_cnt = 0; } } if(w_cnt > 0 && words[words.length-1]) words[words.length-1].length = w_cnt; max_length = Math.max(max_length,w_cnt); pool += chunk[i]; if(max_length==0){ console.log(""); }else{ for(var i in words){ if(words[i].length == max_length){ console.log(words[i].word); } } } }