xxxxxxxxxx
package main
import "fmt"
func main() {
fmt.Println(isPolindrome("ABCDDCBA"))
}
func isPolindrome(str string) bool {
pjg := len(str)
for i := 0; i < pjg; i++ {
x := pjg - 1 - i
if str[i] != str[x] {
return false
}
}
return true
}
xxxxxxxxxx
func main() {
var str string = "ABCDDBA"
data := false
for i := 0; i < len(str)/2; i++ {
if str[i] != str[len(str)-i-1] {
data = false
} else {
data = true
}
}
fmt.Println(data)
}