結果
問題 | No.342 一番ワロタww |
ユーザー |
![]() |
提出日時 | 2016-05-11 13:04:25 |
言語 | JavaScript (node v23.5.0) |
結果 |
AC
|
実行時間 | 74 ms / 5,000 ms |
コード長 | 1,054 bytes |
コンパイル時間 | 99 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 42,208 KB |
最終ジャッジ日時 | 2024-10-12 23:42:25 |
合計ジャッジ時間 | 1,928 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
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); } } } }