5
var wonderfulSubstrings = function (word) {8
binaryRepresentation = 0,14
for (let i = 0; i < word.length; i++) {15
pos = word[i].charCodeAt(0) - "a".charCodeAt(0); //Let's use position 0 for a, 1 for b .... 9 for j17
binaryRepresentation = binaryRepresentation ^ t; //Toggle the bit at pos in the current mask(pattern)18
//This loop will check same binaryRepresentation and all the other binaryRepresentation with difference of 1 bit19
for (let i = 0; i < 10; i++) {20
//Check all the numbers by changing 1 position21
number = 1 << i; //Change 1 bit at a time22
oneBitToggled = binaryRepresentation ^ number;23
if (hashMap[oneBitToggled] !== undefined) {24
ans += hashMap[oneBitToggled];27
if (hashMap[binaryRepresentation] === undefined) {28
hashMap[binaryRepresentation] = 1;30
ans += hashMap[binaryRepresentation];31
hashMap[binaryRepresentation]++;