DEV Community


Discussion on: Daily Challenge #39 - Virus

ynndvn profile image
La blatte

Well, this solution will work in every case but won't be able to handle the 21775 "ie" words:

antidote=(s)=>s.split`. `.map(b=>{b=b.replace(/ie/gi,'ei');return b[0].toUpperCase()+b.slice(1).toLowerCase()}).join`. `
antidote("He haD iEght ShOTs of CAffIEne. aFter thaT HE WenT tO SleeP.")
// "He had eight shots of caffeine. After that he went to sleep."
mangelsnc profile image
Miguel Ángel Sánchez Chordi

There's a known set of rules to avoid handle all the "ie" words:

alvaromontoro profile image
Alvaro Montoro

I was doing something like this. Then I deid testing.