OneCompiler

find match string

251

let str1 = ' this is rohit kannaujiya ,He is IT engineer ';
let str2 = ' this is kavita kannaujiya , She is a Teacher';
let strw1 = str1.replace(/\s+/g, '');
let strw2= str2.replace(/\s+/g, '');
//console.log(strw1.length)
let lattterCount=0;
console.log(" this latter you match with you ")
for(let i =0 ;i< strw1.length ; i++)
{
for(let j=0 ; j< strw2.length ; j++)
{
if(strw1[i] == strw2[j])
{
lattterCount++;
console.log(strw1[i] +" "+ strw2[j]);
break;
}
}

}

console.log("this is total latter match you "+ lattterCount);