I wanted to get number of indexes in two string which are not same.

Things that are fixed:

String data will only have 0 or 1 on any index. i.e strings are binary representation of a number.

Both the string will be of same length.

For the above problem I wrote the below function in python

```
def foo(a,b):
    result = 0
    for x,y in zip(a,b):
        if x != y:
            result += 1
    return result

```

But the thing is these strings are huge. Very large. So the above functions is taking too much time. any thing i should do to make it super fast.

This is how i did same in c++, Its quite fast now, but still can't understand how to do packing in short integers and all that said by @Yves Daoust :

```
size_t diff(long long int n1, long long int n2)
{
long long int c = n1 ^ n2;
bitset<sizeof(int) * CHAR_BIT> bits(c);
string s = bits.to_string();

return std::count(s.begin(), s.end(), '1');

}

```