Submission #3090627


Source Code Expand

Copy
'use strict'
let lines = [];
let reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function(line) {
  lines.push(line);
});

reader.on('close', function() {
    let S = lines[0];
    let dd = ["dream", "erase", "eraser", "dreamer"];
    while(S.length !== 0){
        let flag = false;
        for(let i = 0; i < dd.length; i++){
            let n = dd[i].length;
            if(dd[i] === S.slice(-n)){
                flag = true;
                S = S.slice(0, -n);
            }
        }
        if(!flag){
            console.log("NO");
            return;
        }
    }
    console.log("YES");
});

Submission Info

Submission Time
Task ABC049C - 白昼夢 / Daydream
User my316g
Language JavaScript (node.js v5.12)
Score 300
Code Size 701 Byte
Status
Exec Time 65 ms
Memory 9400 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 300 / 300 subtask0_0.txt, subtask0_1.txt, subtask0_2.txt, subtask1_0.txt, subtask1_1.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_2.txt, subtask1_3.txt, subtask1_4.txt, subtask1_5.txt, subtask1_6.txt, subtask1_7.txt, subtask1_8.txt, subtask1_9.txt
Case Name Status Exec Time Memory
subtask0_0.txt 60 ms 7500 KB
subtask0_1.txt 59 ms 7500 KB
subtask0_2.txt 59 ms 7500 KB
subtask1_0.txt 64 ms 9400 KB
subtask1_1.txt 63 ms 8632 KB
subtask1_10.txt 65 ms 9400 KB
subtask1_11.txt 65 ms 9400 KB
subtask1_12.txt 65 ms 9400 KB
subtask1_13.txt 65 ms 9400 KB
subtask1_14.txt 62 ms 8248 KB
subtask1_15.txt 63 ms 8632 KB
subtask1_2.txt 61 ms 7756 KB
subtask1_3.txt 65 ms 9400 KB
subtask1_4.txt 64 ms 9400 KB
subtask1_5.txt 65 ms 9400 KB
subtask1_6.txt 64 ms 9400 KB
subtask1_7.txt 64 ms 9400 KB
subtask1_8.txt 64 ms 9400 KB
subtask1_9.txt 64 ms 9400 KB