C++ version of Sherlock