Skip to main content
deleted 35 characters in body
Source Link
Dadsdy
  • 2.1k
  • 6
  • 24

Javascript, 140 132132 114 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p ofn=[],l="",(c+',').split`,`){m=l.splitmap(p=>l=a(/[([{]/).length==l.split>a(/[)\]}]/).length;m&&l?nl+','+p:(l&&n.push(l):0;l=m?,p:l+')),'+p}return n});a=r=>l.split(r).length

TIOTIO

Javascript, 140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of(c+',').split`,`){m=l.split(/[([{]/).length==l.split(/[)\]}]/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

Javascript, 140 132 114 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>(n=[],l="",(c+',').split`,`.map(p=>l=a(/[([{]/)>a(/[)\]}]/)?l+','+p:(l&&n.push(l),p)),n);a=r=>l.split(r).length

TIO

deleted 15 characters in body
Source Link
Dadsdy
  • 2.1k
  • 6
  • 24

Javascript, 140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of (c+',').split('split`,')`){m=l.split(/\[(|\[|\[{]/).length==l.split(/\[)|\]|\\]}]/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIOTIO

Javascript, 140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of (c+',').split(',')){m=l.split(/\(|\[|\{/).length==l.split(/\)|\]|\}/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

Javascript, 140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of(c+',').split`,`){m=l.split(/[([{]/).length==l.split(/[)\]}]/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

added 118 characters in body
Source Link
Dadsdy
  • 2.1k
  • 6
  • 24

Javascript, 140140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of (c+',').split(',')){m=l.split(/\(|\[|\{/).length==l.split(/\)|\]|\}/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

Javascript, 140 Bytes

c=>{n=[];l="";for(p of (c+',').split(',')){m=l.split(/\(|\[|\{/).length==l.split(/\)|\]|\}/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

Javascript, 140 132 Bytes

Thanks to @KevinCruijssen for -8 Bytes!

c=>{n=[];l="";for(p of (c+',').split(',')){m=l.split(/\(|\[|\{/).length==l.split(/\)|\]|\}/).length;m&&l?n.push(l):0;l=m?p:l+','+p}return n}

TIO

added 15 characters in body
Source Link
Dadsdy
  • 2.1k
  • 6
  • 24
Loading
Source Link
Dadsdy
  • 2.1k
  • 6
  • 24
Loading