Remove extra spaces on prefixMap input and output.