jacobcieski jacobcieski - 6 months ago 7
Linux Question

Unique character code not working when ran in linux but fine in windows (C++)

When I run the code in windows, it works as expected. But when I run it in linux, the program doesn't run as expected and produces a completely different output.

I'm assuming its a problem in the all_unique_letters method, but I can't seem to figure it out.

Answer

In bool all_unique_letters(const string &s), unsigned int v; is used without being initialized. If it contains something else that 0, the function reports a letter as a duplicate when it is not.