Charlie

Faced this dilemma a whole lot - finally had
to replace carpet in one of my bedroooms -
however you might try pulling up the carpet,
painting the floor in the affected areas, then tack the carpet back down. Of course you need to clean that carpet as best ya can with one of those cleaning agents posted by
previous people. Good Luck!!!!