How To Check Whether 2 Strings differ by at Least 3 Positions

Dears,

How To Check Whether 2 Strings differ by at Least 3 Positions ? Knowing that those strings have same number of characters:

To Clarify this :

Str= KTzp§64!Ae …Original String

Accepted Strings: KTzp§64sss , Kaaa§64!Ae ,KTtttt4!Ae …etc

Wherase : KTzp§64!Ae, azzp§64!Ae ,KTqq§64!Ae, KTzp§74!Ae…etc are not accepted since they are different with original one only by 2 Characters or 1;

Thanks in Advance

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.

reference : Enumerable.Zip Method (System.Linq) | Microsoft Learn

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