This is my code:
package main
import (
"fmt"
)
func isPalindrome(value *string) bool {
for i, j := 0, len(*value)-1; i < j; i, j = i+1, j-1 {
if (*value)[i] != (*value)[j] {
return false
}
}
return true
}
func main() {
var n, count int16
var num string
for fmt.Scanf("%v", &n); n > 0; n-- {
fmt.Scanln(&num)
if isPalindrome(&num) {
count++
}
}
fmt.Println(count)
}
It’s a simple palindrome problem from Problem - A - Codeforces
The problem is that online judge is showing that the above code produces the wrong answer for the input:
4
3
546
74647
74565
The online judge result:
This is really strange because when I run the code using the above input, I get the right answer which is 2, but when the online judge runs it, it gives 3. I am using go version 1.13 but the online judge is running version 1.12. Is there some difference between the two versions of go that might be causing this issue? Or is this a problem with the online judge?
