package main

import (
	"fmt"
	"slices"
)

func main() {
	// section: example
	strings := []string{"Apple", "Orange", "Apple", "Banana"}
	ints := []int{0, 1, 9, 1, 2, 0, 5, 7, 5}

	strings = slices.Replace(strings, 0, 2, "Apple", "Grape")
	ints = slices.Replace(ints, 0, 2, 9, 9)

	fmt.Println(strings)
	fmt.Println(ints)

	// Replace and insert at the same time
	strings = slices.Replace(strings, 0, 0, "Prune", "Pineapple")
	ints = slices.Replace(ints, 0, 0, -1, -1)

	fmt.Println(strings)
	fmt.Println(ints)
	// section: example
}
