Maximum Function Count Python String Manipulation