fix warning: The scope of the variable 'j' can be reduced
fix warning: : The scope of the variable 'res' can be reduced