We have a string S of length L comprising of alphabets between a to z. We write all strings of length L formed by taking just alphabets a and b. If L=3 we can form aaa aba bba etc. If L is 2 we can form ab ba bb and aa .Is there any combinatorics method to find all strings such that hamming distance between S and all letters formed of length L by using a and b is K where k is less than L. Hamming distance is the number of positions at which characters are different in two strings. If string A is AAB and string B is AAC then hamming distance between string A and B is 1. For clarity of question, We form all possible new strings comprising of letter a and b and of length L and out of those strings we choose the ones whose hamming distance with string S is K. If L=5 then there are 2^5 possible strings and out of those we need to check if hamming distance between S and them is equal to k.
let the string be abc.
if we look at all posiible strings of lenth 3 formed by just a nd b are
strings > hamming distance
so ans is 4 if k=2 ,ans is 2 if k=3.