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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(in, &n)
		var str string
		fmt.Fscan(in, &str)
		const SHIFT = 50
		const MAXD = 100
		dp := make([][][]int, n+1)
		for i := 0; i <= n; i++ {
			dp[i] = make([][]int, 3)
			for p := 0; p < 3; p++ {
				dp[i][p] = make([]int, MAXD+1)
				for d := 0; d <= MAXD; d++ {
					dp[i][p][d] = -1
				}
			}
		}
		dp[0][2][SHIFT] = 0
		for i := 0; i < n; i++ {
			for p := 0; p < 3; p++ {
				for dif := 0; dif <= MAXD; dif++ {
					le := dp[i][p][dif]
					if le == -1 {
						continue
					}
					dd := dif - SHIFT
					if dp[i+1][p][dif] < le {
						dp[i+1][p][dif] = le
					}
					ct := 0
					if str[i] == '>' {
						ct = 1
					}
					var nd int
					if p == 2 {
						nd = 0
					} else if p == ct {
						nd = dd
					} else if p == 0 && ct == 1 {
						nd = dd - 1
					} else {
						nd = dd + 1
					}
					ndif := nd + SHIFT
					if ndif >= 0 && ndif <= MAXD {
						nle := le + 1
						if dp[i+1][ct][ndif] < nle {
							dp[i+1][ct][ndif] = nle
						}
					}
				}
			}
		}
		maxlen := 0
		for p := 0; p < 3; p++ {
			for dif := SHIFT; dif <= MAXD; dif++ {
				if dp[n][p][dif] > maxlen {
					maxlen = dp[n][p][dif]
				}
			}
		}
		ans := n - maxlen
		fmt.Println(ans)
	}
}
```