Find the different color tile in the matrix. In c++