const reader = require("readline").createInterface({ input: process.stdin, output: process.stdout }); let lines = []; reader.on("line", line => { lines.push(line); }); reader.on("close", () => { const sum = lines.map(line => line.trim().length).reduce( (accumulator, currentValue) => { return accumulator + currentValue }) if (sum > 10 ) { console.log('BLUE') } else { console.log('RED') } });