Maximum Function Count Python String Replace Not Working