結果

問題 No.342 一番ワロタww
ユーザー yun_appyun_app
提出日時 2016-05-11 13:02:53
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 1,050 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 41,812 KB
最終ジャッジ日時 2024-04-21 01:22:06
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
39,168 KB
testcase_01 AC 71 ms
39,168 KB
testcase_02 AC 71 ms
39,296 KB
testcase_03 AC 65 ms
39,424 KB
testcase_04 AC 64 ms
39,424 KB
testcase_05 AC 65 ms
39,168 KB
testcase_06 AC 64 ms
39,424 KB
testcase_07 AC 66 ms
39,168 KB
testcase_08 AC 67 ms
39,296 KB
testcase_09 AC 67 ms
39,424 KB
testcase_10 AC 65 ms
39,168 KB
testcase_11 AC 65 ms
39,040 KB
testcase_12 AC 66 ms
39,424 KB
testcase_13 AC 67 ms
39,424 KB
testcase_14 AC 66 ms
39,296 KB
testcase_15 AC 64 ms
39,296 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
            }
        }
    }
}
0