new file go/l9.go for counting the word go

This commit is contained in:
hhu67 2026-06-04 16:16:58 +03:00
parent 7a82960a38
commit 574fdaaaea
2 changed files with 28 additions and 8 deletions

20
go/l9.go Normal file
View file

@ -0,0 +1,20 @@
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println("Введите фразу")
var pol string
fmt.Scanln(&pol)
poll := strings.ToLower(pol)
if strings.Contains(poll, "go") {
x := strings.Count(poll, "go")
fmt.Println(x)
} else {
x2 := poll + " go"
fmt.Println(x2)
}
}