For problem statement at 0-999/200-299/240-249/247/problemB.txt this is a correct solution, but verifier at 0-999/200-299/240-249/247/verifierB.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func padBlock(b string) string {
if len(b) >= 4 {
return b
}
return strings.Repeat("0", 4-len(b)) + b
}
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var n int
if _, err := fmt.Fscan(in, &n); err != nil {
return
}
for i := 0; i < n; i++ {
var s string
fmt.Fscan(in, &s)
var result []string
if strings.Contains(s, "::") {
parts := strings.SplitN(s, "::", 2)
leftPart, rightPart := parts[0], parts[1]
var leftBlocks, rightBlocks []string
if leftPart != "" {
leftBlocks = strings.Split(leftPart, ":")
}
if rightPart != "" {
rightBlocks = strings.Split(rightPart, ":")
}
for _, b := range leftBlocks {
result = append(result, padBlock(b))
}
missing := 8 - (len(leftBlocks) + len(rightBlocks))
for j := 0; j < missing; j++ {
result = append(result, "0000")
}
for _, b := range rightBlocks {
result = append(result, padBlock(b))
}
} else {
blocks := strings.Split(s, ":")
for _, b := range blocks {
result = append(result, padBlock(b))
}
}
fmt.Fprintln(out, strings.Join(result, ":"))
}
}