mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
584 B
584 B
doppelganger
Instructions
You are given 2 strings. Find out if first string contains second string. If it does, return index of the first string where second string occurs last time. If it does not contain, return "-1"
Expected function
package main
func DoppelGanger(s, substr string) int {
}
package main
import "fmt"
func main() {
var result int
result = DoppelGanger("aaaaaaa", "a")
fmt.Println(result) // 6
result = DoppelGanger("qwerty", "t")
fmt.Println(result) // 4
result = DoppelGanger("a", "b")
fmt.Println(result) // -1
}