Skip to main content
4 of 6
updated the byte count, off by 1
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

Javascript (ES6), 121 bytes

s=>s="[["+(s=s.trim().replace(/(.) +/g,"$1, ").split(/\n */)).join("], [")+`]]
{{`+s.join("}, {")+`}}
[`+s.join("; ")+"]"

Example code snippet:

f=

s=>s="[["+(s=s.trim().replace(/(.) +/g,"$1, ").split(/\n */)).join("], [")+`]]
{{`+s.join("}, {")+`}}
[`+s.join("; ")+"]"

console.log(f(
`1 -2
 3  5
 6  7`
))

Endenite
  • 4.1k
  • 12
  • 28