Iterate over a file multiple times
Slightly better way:

    candidates.close();                 //I know theres better than this


If improvement is based on this statement, then something like stringstream would be good fit.

Best way:

std::map&lt;std::string, std::size_t&gt; will fit the job nicely. After you've done with it, just iterate through and see if anything has counter equal to 2 or higher, and print those.

Roughly this:

std::map&lt;std::string, std::size_t&gt; appearance_count;
while (std::getline(answers, s)) 
{
    ++appearance_count[s];
}
while (std::getline(candidates, s)) 
{
    ++appearance_count[s];
}

for (const auto&amp; reading: appearance_count)
{
    if (reading.second &gt; 1)
    {
        std::cout &lt;&lt; reading.first &lt;&lt; '\n';
    }
}


Some edge cases:

There might be duplications in the first file, so it will require first adding into std::set, then adding to the map. Second file is unaffected by that, since any string with appearance count larger than 1 is already wanted. Though if the second file contains duplicates as well, you'll need two sets.