Just JavaScript this year. Using Node.js for convenience. If it's not obvious where the input comes from, do: node 1a.js < 1a.txt