solve 2-2_fence-repair.cpp