bird follow        

Run Settings
LanguageJavaScript
Language Version
Run Command
function processData(input) { field = input.split("\n") arr = field[1].split(" ") res = [[0,],[0,],[0,],[0,],[0]] type = [] for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length; j++) { if (arr[i] == arr[j]) { type.push(arr[i]); } } } for (let i = 0; i < type.length; i++) { if (type[i] == 1) { res[0][1] = 1 res[0][0] ++ } if (type[i] == 2) { res[1][1] = 2 res[1][0] ++ } if (type[i] == 3) { res[2][1] = 3 res[2][0] ++ } if (type[i] == 4) { res[3][1] = 4 res[3][0] ++ } if (type[i] == 5) { res[4][1] = 5 res[4][0] ++ } } console.log(type); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });
Editor Settings
Theme
Key bindings
Full width
Lines