import { Solver, State } from "./solver.ts"; const input = await Deno.readTextFile("input.txt"); const lines = input.split("\n").map(x => x.trim()).filter(x => x.length > 0); const datas = lines.map(x => { const [statesStr, groupsStr] = x.split(" "); return { state: statesStr.split(""), group: groupsStr.split(",").map(x => parseInt(x)) }; }) const ways = datas.map(data => { const ret = new Solver(data.state as State[], data.group).solve(0, 0); console.log(data.state.join(""), data.group, ret); return ret; }); console.log(ways.reduce((a, b) => a + b, 0));