bracket Problem Solve with recursive function