package main import ( "bufio" "fmt" "os" ) func main() { input := bufio.NewScanner(os.Stdin) var output string for input.Scan() { line := input.Text() output = replaceSpace(line) fmt.Println(output) } } func replaceSpace(s string) string { var last string for _, v := range s { if string(v) == " " { last += "%20" continue } last += string(v) } return last }