← Home
For problem statement at 1000-1999/1100-1199/1100-1109/1102/problemD.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1100-1109/1102/verifierD.go ends with All tests passed can you fix the verifier? ```go
package main

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

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var n int
	var s string
	fmt.Fscan(in, &n, &s)

	b := []byte(s)
	target := n / 3
	cnt := [3]int{}

	for _, c := range b {
		cnt[int(c-'0')]++
	}

	for i := 0; i < n; i++ {
		d := int(b[i] - '0')
		if cnt[d] > target {
			for nd := 0; nd < d; nd++ {
				if cnt[nd] < target {
					cnt[d]--
					cnt[nd]++
					b[i] = byte('0' + nd)
					break
				}
			}
		}
	}

	for i := n - 1; i >= 0; i-- {
		d := int(b[i] - '0')
		if cnt[d] > target {
			for nd := 2; nd > d; nd-- {
				if cnt[nd] < target {
					cnt[d]--
					cnt[nd]++
					b[i] = byte('0' + nd)
					break
				}
			}
		}
	}

	fmt.Fprint(out, string(b))
}
```