import maya.cmds as mc
GMH_GrpName=mc.ls(sl=1)[0]
grpName=mc.ls(sl=1)[0].split('_')[0]
mc.select(hi=True)
follicleList=mc.ls(type="follicle",selection=True)
hairSstList=mc.ls(type="hairSystem",selection=True)
pfxHairList=mc.ls(type="pfxHair",selection=True)
shapeList=follicleList+hairSstList+pfxHairList
TransformList=mc.listRelatives(shapeList,parent=1,fullPath=1)
mc.select(TransformList)
mc.parent(w=True)
mc.group(n=grpName+'HairSysGrp')
mc.group(follicleList,name='follicleGrp')
mc.delete(GMH_GrpName)