Exact distributed quantum algorithm for generalized Simon's problem