You can’t avoid repetition because you have to split the names string at those points – once when Person is initialised, and once when a new name string is provided. You cannot avoid this, the program cannot work if you don’t do it, there’s nothing wrong with it.
You could wrap it in a function, but that would be pointless – it’s still repetition, and for the sake of changing the name of something to pretend it’s cleaner code you’d be adding a needless extra function call.
If you are looking to refactor some code to avoid repeating things (this is not one of these situations), then probably wait until you’ve had to copy paste something at least three or four times before you even start thinking about it at all