We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
functionabbreviation(a,b){// Write your code hereconstarrA=a.split('');constarrB=b.split('');letnewArr=[];functionisLowerCase(text){returntext===text.toLowerCase()&&text!==text.toUpperCase();}for(leti=0;i<arrA.length;i++){for(letj=0;j<=arrB.length;j++){if(!isLowerCase(arrA[i])){newArr.push(arrA[i]);break}if(isLowerCase(arrA[i])){arrA[i].toUpperCase()===arrB[j]&&newArr.push(arrB[j]);}}}console.log(newArr)for(leti=0;i<newArr.length;i++){if(arrB[i]!==newArr[i]){return'NO'break}}return'YES'}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Abbreviation
You are viewing a single comment's thread. Return to all comments →
WHY?????