Skip to main content
9 bytes off
Source Link
removed
  • 2.8k
  • 14
  • 31

JavaScript, 194194 185 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,(k='_'.repeat(s/2))+b+k+(s%2?'_':'')),[mH=(e,y)=>e.map((x,i)=>G(x,i,1y)).join` `, n.map([H(xm,i1)=>G(x,i)H(n).join` `]])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            (k='_'.repeat(s/2))+b+k+(s%2?'_':'')
        ),
    [mH=(e,y)=>e.map((x,i)=>G(x,i,1y)).join` `,
     n.map([H(xm,i1)=>G(x,i)H(n).join` `]]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

JavaScript, 194 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,(k='_'.repeat(s/2))+b+k+(s%2?'_':'')),[m.map((x,i)=>G(x,i,1)).join` `, n.map((x,i)=>G(x,i)).join` `])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            (k='_'.repeat(s/2))+b+k+(s%2?'_':'')
        ),
    [m.map((x,i)=>G(x,i,1)).join` `,
     n.map((x,i)=>G(x,i)).join` `]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

JavaScript, 194 185 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,(k='_'.repeat(s/2))+b+k+(s%2?'_':'')),H=(e,y)=>e.map((x,i)=>G(x,i,y)).join` `,[H(m,1),H(n)])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            (k='_'.repeat(s/2))+b+k+(s%2?'_':'')
        ),
    H=(e,y)=>e.map((x,i)=>G(x,i,y)).join` `,
    [H(m,1),H(n)]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

1 byte off
Source Link
removed
  • 2.8k
  • 14
  • 31

JavaScript, 195194 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,'_'(k='_'.repeat(s/2)+b+'_'.repeat)+b+k+(s/2+s%2s%2?'_':'')),[m.map((x,i)=>G(x,i,1)).join` `, n.map((x,i)=>G(x,i)).join` `])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            '_'(k='_'.repeat(s/2)+b+'_'.repeat)+b+k+(s/2+s%2s%2?'_':'')
        ),
    [m.map((x,i)=>G(x,i,1)).join` `,
     n.map((x,i)=>G(x,i)).join` `]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

JavaScript, 195 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,'_'.repeat(s/2)+b+'_'.repeat(s/2+s%2)),[m.map((x,i)=>G(x,i,1)).join` `, n.map((x,i)=>G(x,i)).join` `])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            '_'.repeat(s/2)+b+'_'.repeat(s/2+s%2)
        ),
    [m.map((x,i)=>G(x,i,1)).join` `,
     n.map((x,i)=>G(x,i)).join` `]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

JavaScript, 194 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,(k='_'.repeat(s/2))+b+k+(s%2?'_':'')),[m.map((x,i)=>G(x,i,1)).join` `, n.map((x,i)=>G(x,i)).join` `])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            (k='_'.repeat(s/2))+b+k+(s%2?'_':'')
        ),
    [m.map((x,i)=>G(x,i,1)).join` `,
     n.map((x,i)=>G(x,i)).join` `]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'

Source Link
removed
  • 2.8k
  • 14
  • 31

JavaScript, 195 bytes

f=(m,n)=>(m=m.split` `,n=n.split` `,G=(x,i,a)=>x[0]!='_'?x:(b=(a?n:m)[i],s=x.length-b.length,'_'.repeat(s/2)+b+'_'.repeat(s/2+s%2)),[m.map((x,i)=>G(x,i,1)).join` `, n.map((x,i)=>G(x,i)).join` `])

Takes two strings as parameters and outputs two strings as array/list

f=(m,n)=>(
    m=m.split` `,
    n=n.split` `,
    G=(x,i,a)=>
        x[0]!='_'?x:
        (
            b=(a?n:m)[i],
            s=x.length-b.length,
            '_'.repeat(s/2)+b+'_'.repeat(s/2+s%2)
        ),
    [m.map((x,i)=>G(x,i,1)).join` `,
     n.map((x,i)=>G(x,i)).join` `]
)

document.body.innerHTML = '<pre>' +
    "f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum')<br>" +
    f('lorem _____ dolor _____ amet _______________ adipiscing elit mauris dapibus tincidunt _____________________________ accumsan fringilla proin vulputate viverra lorem fermentum dictum', 'lorem ipsum ______ sit _______ consectetur _______________ elit mauris dapibus tincidunt metus accumsan fringilla proin vulputate viverra lorem ____________________________ dictum') + "<br><br>" +
    "f('programming _____________ and code golf', 'programming puzzles ______ code ____')<br>" +
    f('programming _____________ and code golf', 'programming puzzles ______ code ____')
'</pre>'