I have a file with a lot of words in it, and i have to split the word that a part of it already existed or appear during the scanning of the file:
Some of the words in the file are
member
members
membership
memberships
I have tried this, but I wanted the first lines[i](which is a) to keep looping the next words
func Split(lines []string) string {
for i := 0; i < len(lines)-1; i++ { // position of words
j := i + 1
fmt.Println(lines[i], lines[j])
if strings.ContainsAny(lines[j], lines[i]) {
s := strings.Split(dictionary[j], dictionary[i])
fmt.Println(dictionary[i], ".", s)
}
}
...
}
but it only outputs
member
member.s
members.hip
membership.s
The output that i want:
member
member.s
member.ship
members.hip
member.ships
members.hips