This is C# Code for checking whether 2 strings differ by at least 3 position.
this code used 2 linq function, Zip, Sum.
zip function make new sequence with the corresponding elements of 2 sequences.
for example Two Sequence {1,2,3}, {“a”,“b”,“c”} => {(1,“a”),(2,“b”),(3,“c”)}
c# code
string1.ToCharArray().Zip(string2.ToCharArray(),(c1,c2)=>(c1==c2?0:1)).Sum();
Above c# code will sum the count of different of two strings.
Suppose both string have same length.
Loop through each string from beginning to end and increment the counter if letter matches.
If counter is 3 at the end of the loop, then that is the string you need to find.
Below code shows how to check whether letter matches at the certain index for string a and b. a(index).Equals(b(index)).tostring