Implement function to replace all spaces in a string with '%20'