Duplicate text finder in C++