recursive remove duplicate char