Online judge showing wrong answer for simple palindrome program

This is my code:

package main

import (

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-- {
		if isPalindrome(&num) {

It’s a simple palindrome problem from
The problem is that online judge is showing that the above code produces the wrong answer for the input:


Try it online!

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?

  • Throw some \n’s into your format string for Scanf.
  • Rethink the function (why the pointer? simplify the loop, no need for two variables there).

This won’t be the first time, I’ve encountered a problem with the online judge saying something is wrong without showing what is actually wrong with the output, or in this case showing a total different output from what should have printed.