How to compare two strings and get its percentage

Yes, so you have to adapt your calculation logix to the Algorithmn ones

e.g.
string1 : Preeti Bohra
string: Bohra Preeti

split the words
Order the words
then calculate the Percentage

e.g.
string1: Preeti Bohra
String2: Preeti Boh
Percentage: 70%

same actions as above, but different and unclear the 70% Formula

So just adapt / Combine the different approaches for your implementation