remove trailing space in ai