remove_ac_terms function

Remove A and C terms that appear as B terms