Can you help me figure out where the first solution breaks down (NPLQ19D)?

Problem statement: NPLQ19D
Solution one: WA
Solution two: AC

your code fails for this type of test
1
zwsvso

Hey, thanks :slightly_smiling_face: Do you know why it fails there?

i don’t know how unordered_set places(str.begin(),str.end()); this works

unordered_set places(str.begin(),str.end()) this changes the order of characters in places while copying.
using a normal vector like this should be better https://ideone.com/9LHeAb i guess.