Can u plz tell why this code generate correct output

sorry not generating correct output*

hello @Ashu1318
no u logic is not correct.

dont convert to integer ,instead iterate from i=0 to i=n-1
if s1[i]==s2[i] print 0
else print 1

but let’s say x=a^b;

and convert x int0 binary ,it would be same ans

yeah but
for example s1=β€˜101’
β€œ101” get converted to 101 using stoi.
but what u want is 5 (decimal representation of 101).