← Home
For problem statement at 1000-1999/1600-1699/1680-1689/1685/problemB.txt this is a correct solution, but verifier at 1000-1999/1600-1699/1680-1689/1685/verifierB.go ends with case 3 failed
input:
1
0 1 3 0
BBAAABB
expected:NO
actual:YES
exit status 1 can you fix the verifier?  ```go
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 1024*1024), 1024*1024)
	var t int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &t)
	for ; t > 0; t-- {
		var a, b, c, d int
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d %d %d %d", &a, &b, &c, &d)
		scanner.Scan()
		s := scanner.Text()

		cntA := 0
		for i := 0; i < len(s); i++ {
			if s[i] == 'A' {
				cntA++
			}
		}
		cntB := len(s) - cntA

		if a+c+d != cntA || b+c+d != cntB {
			fmt.Println("NO")
			continue
		}

		ok := true
		n := len(s)
		for i := 0; i < n; {
			j := i
			for j+1 < n && s[j] != s[j+1] {
				j++
			}
			L := j - i + 1
			if L >= 2 {
				k := L / 2
				if s[i] == 'A' && s[j] == 'B' {
					if c < k-1 {
						if d < k-1 || a == 0 || b == 0 {
							ok = false
						}
					}
				} else if s[i] == 'B' && s[j] == 'A' {
					if d < k-1 {
						if c < k-1 || a == 0 || b == 0 {
							ok = false
						}
					}
				}
			}
			i = j + 1
		}

		if ok {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}
```