# 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 <!-- begin snippet: js hide: true --> <!-- language: lang-js --> 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>' <!-- end snippet -->