#! /usr/bin/node const readable = process.stdin let buffer = "" readable.on('readable', () => { let chunk; while (null !== (chunk = readable.read())) { buffer += chunk } }) readable.on('end', () => { let points = [] let lines = [] let x = [] let y = [] buffer.split(/\r?\n/).forEach(line => { let f=line.split(",") for (let i = 0; i < f.length; i++) { if (i % 2 == 0) { x.push(f[i]) } else { y.push(f[i]) } } if (f.length == 4) { lines.push(f) } else if (f.length == 2) { points.push(f) } }) let mnx = Math.min(...x) let mxx = Math.max(...x) let mny = Math.min(...y) let mxy = Math.max(...y) let lo = [ mnx - (mxx-mnx)/10, mny - (mxy-mny)/10, ] let hi = [ mxx + (mxx-mnx)/10, mxy + (mxy-mny)/10, ] let w = hi[0]-lo[0] let h = hi[1]-lo[1] console.log(``) console.log(``) console.log(``) if (lines.length > 0) { console.log(` `); for (let p of lines) { console.log(` `) } console.log(" ") } if (points.length > 0) { console.log(` `); for (let p of points) { console.log(` `) } console.log(" ") } console.log("") })