package main
import (
"fmt"
"strings"
)
func main() {
keywords := []string{"Google", "search", "engine", "results", "SEO"} // Keywords to exclude
text := "I like using Google search engine to get results. SEO is important."
excludedText := excludeKeywords(text, keywords)
fmt.Println(excludedText)
}
func excludeKeywords(text string, keywords []string) string {
words := strings.Fields(text)
var filteredWords []string
for _, word := range words {
shouldExclude := false
for _, keyword := range keywords {
if strings.EqualFold(word, keyword) {
shouldExclude = true
break
}
}
if !shouldExclude {
filteredWords = append(filteredWords, word)
}
}
return strings.Join(filteredWords, " ")
}