+ 4

Compare two input strings

please help me! 🙏 how can I campare two input strings and print the number of differences? .... for example : Input: Nbbjhfdg Nbbghydg output : 2

10th Dec 2016, 10:45 AM
PayaM
PayaM - avatar
6 Réponses
+ 1
To test for a loose correlation you will need to use 'Fuzzy matching' there are many methods and the algorithms can be quite complex to implement. I suggest you start researching 'Levenshtein distance'
10th Dec 2016, 1:09 PM
Kerrash
Kerrash - avatar
+ 1
@sushmita how actually I code that that's the point
10th Dec 2016, 1:16 PM
PayaM
PayaM - avatar
10th Dec 2016, 1:17 PM
Kerrash
Kerrash - avatar
- 1
use this statements with including string header string s1, s2; if(s1==s2) or bool x=s1.compare(s2); // returns true or false if(s1>s2) if(s1<s2)
10th Dec 2016, 10:55 AM
Morpheus
Morpheus - avatar
- 1
well u can get the difference of sums of ASCII values for ur string ,
10th Dec 2016, 1:17 PM
Morpheus
Morpheus - avatar
- 1
Hello roshan, I ve written the code as mentioned, check in my codes for "string subtraction", it ll help you
10th Dec 2016, 1:54 PM
Morpheus
Morpheus - avatar