← Home
For problem statement at 1000-1999/1600-1699/1600-1609/1606/problemA.txt this is a correct solution, but verifier at 1000-1999/1600-1699/1600-1609/1606/verifierA.go ends with All 100 tests passed can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var s string
		fmt.Fscan(in, &s)
		b := []byte(s)
		// The number of "ab" substrings equals the number of "ba" substrings
		// if and only if the string starts and ends with the same character.
		// If they differ, changing the last character to the first character
		// (or vice-versa) equalizes the counts with 1 step, which is minimum.
		if b[0] != b[len(b)-1] {
			b[len(b)-1] = b[0]
		}
		fmt.Fprintln(out, string(b))
	}
}
```