Max frequency character question

what is wrong in this code?