sounds a little bit like homework but maybe not
yum remove ??????
--- or this ---
yum erase ???????
is just fine
you might want to read the man page
for most 99.9% there is no need to remove folders.
UNLESS there are files in them that were NOT installed by the package manager
yum IS used so you do not have to use "rpm" except as a last resort
and never never NEVER
use the " -y" option with uninstalling programs