classSolution { public: boolisUnique(string astr){ longint left = 0, right = 0; // noticed 'left' should be equal to 0 bool flag = true; for(int i=0; i<astr.size(); ++i) { int cur_num = int(astr[i]); if(cur_num >= 64) { longint cur = long(1) << (cur_num - 64); // noticed '1' should be the type of 'long int' if((left & cur) == 0) // noticed the priority of the '&' and '==' { left = left | cur; } else { flag = false; break; } } else { longint cur = long(1) << cur_num; if((right & cur) == 0) // noticed the priority of the '&' and '==' { right = right | cur; } else { flag = false; break; } } } return flag; } };