Using std::find() is not a safe way to do string comparisons. It finds a substring, but you want to compare entire string. Use std::compare().