the output is correct but third condition not satisfied.