function parseInput(input) {
const botnet = {};
input.split("\n").forEach((line) => {
const match = line.match(
/(\d+)(?:.*low| goes) to (bot|output) (\d+)(?:.*(bot|output) (\d+))?/
);
if (match[4] == undefined) {
addValue(match[2] + match[3], Number(match[1]), botnet);
} else {
botnet["bot" + match[1]] = {
vals: botnet["bot" + match[1]] ? botnet["bot" + match[1]].vals : [],
low: match[2] + match[3],
hi: match[4] + match[5]
};
}
});
return botnet;
}