Files
  • main.go
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main

import (
	"fmt"
	"unicode"
)

func main() {

	var ip string
	fmt.Println("Enter any word")

	fmt.Scanf("%s\n", &ip)

	fmt.Println(IsPalindrome(ip))
}
func IsPalindrome(s string) string {

	var letters []rune
	//var str string
	for _, r := range s {
		if unicode.IsLetter(r) {

			letters = append(letters, unicode.ToLower(r))
		}
	}
	for i := range letters {
		if letters[i] != letters[len(letters)-1-i] {
			return "No! It's not a palindrome"
		}
	}
	return "Yes! It's a Palindrome"
}
go version go1.9.4 linux/amd64