@anonymous/

WastefulInfantileBackswimmer

Go

No description

fork
loading
Files
  • main.go

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.23475314919786805","path":"main.go","file":{"path":"main.go","content":{"asEncoding":{"base64":"cGFja2FnZSBtYWluDQoNCmltcG9ydCAoDQoJImZtdCINCgkic3RyaW5ncyINCikNCg0KZnVuYyBtYWluKCkgew0KDQoJdmFyIGlwIHN0cmluZw0KCWZtdC5QcmludGxuKCJFbnRlciBzdHJpbmc6IikNCglmbXQuU2NhbmYoIiVzXG4iLCAmaXApDQoJaXAgPSBzdHJpbmdzLlRvTG93ZXIoaXApDQoJZm10LlByaW50bG4oaXNQKGlwKSkNCn0NCg0KZnVuYyBpc1AocyBzdHJpbmcpIHN0cmluZyB7DQoJbWlkIDo9IGxlbihzKSAvIDINCglsYXN0IDo9IGxlbihzKSAtIDENCglmb3IgaSA6PSAwOyBpIDwgbWlkOyBpKysgew0KCQlpZiBzW2ldICE9IHNbbGFzdC1pXSB7DQoJCQlyZXR1cm4gIk5PLiBJdCdzIG5vdCBhIFBhbGltZHJvbWUuIg0KCQl9DQoJfQ0KCXJldHVybiAiWUVTISBZb3UndmUgZW50ZXJlZCBhIFBhbGluZHJvbWUiDQp9DQo="},"asBuffer":null},"loaded":true}}
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
package main

import (
	"fmt"
	"strings"
)

func main() {

	var ip string
	fmt.Println("Enter string:")
	fmt.Scanf("%s\n", &ip)
	ip = strings.ToLower(ip)
	fmt.Println(isP(ip))
}

func isP(s string) string {
	mid := len(s) / 2
	last := len(s) - 1
	for i := 0; i < mid; i++ {
		if s[i] != s[last-i] {
			return "NO. It's not a Palimdrome."
		}
	}
	return "YES! You've entered a Palindrome"
}