working pattern match soln